Google Currency Conversion…

Well, the api is pretty straight forward.  It was found in the Currency Conversion gadget from iGoogle by http://oohhyeah.blogspot.com/2009/01/google-currency-conversion-api.html

Here is the example:
http://www.google.com/ig/calculator?hl=en&q=100EUR%3D%3FGBP

And the resposnse looks like this:
{lhs: “100 Euros”,rhs: “191.745037 British pounds”,display: “DISPLAY_FULL_PAGE”,error: “”,icc: true}

Heres how to do it in PHP


$amount = "100";

$from_Currency = "EUR";

$googleResponce = file_get_contents('http://www.google.com/ig/calculator?hl=en&q=' . $amount . $from_Currency . '%3D%3FGBP');

$googleResponce = explode(',', $googleResponce);

$numberInGBP = number_format(round(trim(str_ireplace(array('rhs: "', ' British pounds"'), '', $googleResponce[1])), 2), 2);

echo $numberInGBP;
Google Currency Conversion…

One thought on “Google Currency Conversion…

  1. hozza says:

    Good old iG by Google is dead nowadays – and they are less forthcoming with their API access too…

Leave a Reply

Your email address will not be published. Required fields are marked *