![]()
With global economic meltdowns & fluctuating prices, we often can’t rely on human entry to get up to date currency rates in our web applications. Especially if you are building a website which may require your products cost to be displayed in various currencies.
This is a very powerful and light weight PHP class that lets you convert between 65+ currencies using Google Finance (http://www.google.com/finance/converter)
Example:
CurrencyRates::Convert('USD', 'INR');
Output:
49 //Since $1 is Rs. 49
Downloads:
The URL has changed to :
$url = “http://www.google.com/finance/converter?a=1&from=$from&to=$to”;
Hey Nick
Thanks for updating on the new url to google finance. I have updated the code and the post with the latest working class file.
Cheers!
The script have some problems … first, the convert method did not receive any price to convert. That price need to be include in the google call.
The convert method is coded for 1 unit of currency. If you wish to convert more than 1 unit, then you can multiply it outside the class.
Great, very helpful, I managed to integrate it into CakePHP as a helper easily to!
Fantastic bit of code - I didn’t realise that converting currencies like this could be so easy!
@Marc Warne
I’m glad you liked it!