There are so many websites out there who can calculate Currency Exchange Rates for you, e.g. Google Search, Bing Search or Yahoo Currency Converter. But what if you just want to have the exchange rate to use in your Desktop or Web Application? It would be kinda troublesome to extract the rate from one of the websites above, especially when they decide to change the layout of their HTML code.
That’s why I decided to create a very simple Currency Exchange Rates API. This API allows you to either get the conversion rate from US Dollar to your desired currency or can directly convert an entered value. The output is plain text, without HTML or XML attributes for easy access from all sources.
How does it work?
Just call the URL of the API with your desired exchange rate as parameter, e.g.
for Euro. This will return the exchange rate from USD to EUR:

Which currencies are supported?
All in all, 126 different currencies are supported. See a list of all supported currencies on the index page.
Are the values up-to-date?
The API updates itself once an hour, so the values you’re getting may be up to 1h old. This should be good enough since these values are for information purposes only.
How can I use the API on my website?
This example shows how to use the API to display 100$ in € (please replace the & stuff in the URL with a normal &, can’t display it correctly here):
$oricurr = "USD" // iso code for your original currency
$newcurr = "EUR" // iso code for your new currency
$url = "http://www.multimolti.com/apps/currencyapi/calculator.php?original=".$oricurr."&target=".$newcurr."&value=".$amount;
$result = file_get_contents($url);
echo $result." ".$newcurr;
How does the calculator work?
The calculator works almost the same way as the API itself. Call calculator.php with three parameters: original, target and value. original and target are ISO codes of the currency, and value is the amount of orignal currency to convert. The output is the corresponding amout of target currency.

How accurate are the values?
The acuracy of the exchange rates can’t be guaranteed. All values are for informational purposes only. See the footer of the index page for more information.
Mirrors (most recent list):
- http://www.multimolti.com/apps/currencyapi/index.php
- http://www.lennart-moltrecht.com/apps/currencyapi/
- http://tp1.com.ar/currency/
- http://www.sann-gmbh.com/currencyapi/
Please use multimolti.com or sann-gmbh.com since they’re the most stable ones!
Websites using the Currency Exchange Rates API:
- http://momento24.com/en/, “Currency” tab in the sidebar.
- More will hopefully follow soon!
If there are any questions about the API, bug reports or feature requests, please feel free to comment!
August 3rd, 2009 at 9:17 am
been looking for something like this, but im not sure how to use it, though…
would you please be so kind to provide an example of how to use this on wordpress?
thanks a lot
August 3rd, 2009 at 9:29 am
Well, this API is actually for automatic usage. You could use it in your theme somehow like this:
< ?
$amount = 100; // amount in your original currency, e.g USD
$oricurr = "USD" // iso code for your original currency
$newcurr = "EUR" // iso code for your new currency
$url = "http://www.lennart-moltrecht.com/apps/currencyapi/calculator.php?original=".$oricurr."&target=".$newcurr."&value=".$amount;
$result = file_get_contents($url);
echo $result." ".$newcurr;
?>
This will output the current amount of 100 USD in EUR every time a visitor visits your website.
August 3rd, 2009 at 9:30 am
wow! that was fast!
i’ll try and see how it goes
THANK YOU!
August 3rd, 2009 at 9:33 am
Oh, you have to replace the first line of my code, it says “< ?” there, actually no space should be between < and ?, but my WordPress put it there automatically.
If it doesn’t work, try using “<?php” instead of “<?”.
August 4th, 2009 at 6:24 am
i’m using it, and is working like a charme.. i’ve tried to paste the code im using, but somehow i think i get rejected
any way, i was having an overload on my server, yesterday august the 3rd between 1pm and 4pm of my local time (-3gmt)…
i know that it could’nt possible be this, but, was your site down by any chance?
thank you
August 4th, 2009 at 10:50 am
Cool that you’re using my API =)
And yeah, it was probably my site that was down… the server is really shit, i have to get a newer and faster one soon…
August 4th, 2009 at 5:11 pm
is there a way i can help?
i don’t know how does the api work exactly, but if it’s just a couple of php files retrieving info from another server, i can host it for my own so i don’t use your bandwidth…
this is such a fine solution that i refuse to believe that it could be causing problems on my site….
thanks!
August 4th, 2009 at 6:42 pm
no, its actually a very easy PHP script. it just needs around 10kb webspace and a mysql database. i can send you the files if you want to host them, bandwidth shouldnt be a problem since it usually only sends around 5 characters…
August 4th, 2009 at 7:33 pm
if you are kind enough to do that, i’ll try to set up a mirror and see if the issues i had was because of this…
of course, if everything is working ok, i’ll let you know and you can use it as a mirror…
you’ve got my email…
thank you!!
August 4th, 2009 at 9:15 pm
Sent you a mail… Is http://noticiasaudio.com/ the website you’re using the API with? Can you tell me where? And can I link your website on the API’s page to show which sites are using it already?
October 17th, 2009 at 6:01 pm
I may seem like a noob but how do I use this on my own site? What should the HTML look like when I use it on a normal website?
October 18th, 2009 at 12:03 am
@Nathan:
Well, you will only be able to use this in combination with PHP. You may also just include the exchange rate with an iFrame, but that wouldn’t be that useful, I guess.
I added an example of how to use this API with PHP above, hope it helps you. If there are more questions, feel free to ask.
November 13th, 2009 at 5:50 pm
using this with a combination of filemaker and java, works like a charm. thanks alot
November 29th, 2009 at 7:47 pm
It Works gr8.
I will post a little Script for them who wanna Convert 1 EUR to USD GBP and CHF Sure u can change Original and Target as u want and implement them on ur site as u want
Here is a little Script ..
5)
{
$USD = substr(”$usd1″, 0, -8);
}
$gbp1 = file_get_contents(’http://www.lennart-moltrecht.com/apps/currencyapi/calculator.php?original=EUR&target=GBP&value=1′);
if(strlen($gbp1) > 5)
{
$GBP = substr(”$gbp1″, 0, -8);
}
$chf1 = file_get_contents(’http://www.lennart-moltrecht.com/apps/currencyapi/calculator.php?original=EUR&target=CHF&value=1′);
if(strlen($chf1) > 5)
{
$CHF = substr(”$chf1″, 0, -8);
}
?>
It Will Look Like This:
1.499
0.909
1.507
So u can add any Layout or anything u want in the HTML Code ..
Thank You for ur script
November 29th, 2009 at 7:48 pm
Hmmm sorry here is the code one more time ..
5)
{
$USD = substr(”$usd1″, 0, -8);
}
$gbp1 = file_get_contents(’http://www.lennart-moltrecht.com/apps/currencyapi/calculator.php?original=EUR&target=GBP&value=1′);
if(strlen($gbp1) > 5)
{
$GBP = substr(”$gbp1″, 0, -8);
}
$chf1 = file_get_contents(’http://www.lennart-moltrecht.com/apps/currencyapi/calculator.php?original=EUR&target=CHF&value=1′);
if(strlen($chf1) > 5)
{
$CHF = substr(”$chf1″, 0, -8);
}
?>
November 29th, 2009 at 7:54 pm
Im sorry it dont shows the whole code.
u can download the code from here
http://www.file-upload.net/download-2045508/exchange.zip.html
November 30th, 2009 at 10:42 pm
Thanks for your code!
November 30th, 2009 at 10:43 pm
@Guri:
Just a small addition, please don’t use lennart-moltrecht.com as host, rather use this domain (multimolti.com) since it’s more stable and thus your website will work better!
November 30th, 2009 at 11:11 pm
@Lennart Moltrecht:
Thank You . I will change it.
Kind Regards,
Guri
January 11th, 2010 at 4:39 pm
Hi!
I am also interested in hosting a mirror … can you send me the files, too?
Best wishes
Carsten
January 11th, 2010 at 5:33 pm
Done, thanks for your mirror! I added it to the list!
Leave a Reply