Recently, I searched a way to get the conversion of some money. I usually use the function in google.

Google Currency Convert
After some research, I found this website : google finance API. Some guys work with this websites.
This one give us a class in PHP.
I try to use it but I got an error with a regular expression. As I’m bad, I remove it and work with a string. I’m pretty sur that it is slower but it is enough efficient for my need.
/** * Based on * http://www.chazzuka.com/blog/?p=104 * PHP class Google Currency Converter * Feb 06 2009 * webmaster@chazzuka.com * with my modification : * work with string instead of regular expression */ class GoogleCurrencyConverter { CONST GOOGLE_URL = "http://finance.google.com/finance/converter?a=%d&from=%s&to=%s"; private function load($a,$from,$to) { $ch = curl_init (); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, sprintf(self::GOOGLE_URL,$a,$from,$to)); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $response = curl_exec($ch); curl_close($ch); return $response; } public static function convert($a,$from,$to) { //if the currency is the same return thr same amount if($from !='EUR') { $response = self::load($a,$from,$to); $domaine = strstr($response, '<span class=bld>'); return floatval(substr($domaine,16,strpos($domaine, '&') )); } else return $a; } }
http://oohhyeah.blogspot.com/2009/01/google-curre...
Here is templage in php:
$amount = "100";
$from_Currency = "EUR";
$to_Currency = "AUD";
$query_URL = "http://www.google.com/ig/calculator?hl=en&q=$amount$to_Currency.%3D%3F$to_Currency";
And the resposnse looks like this:
{lhs: "100 Euros",rhs: "191.745037 Australian dollars",display: "DISPLAY_FULL_PAGE",error: "",icc: true}
and ?