Thursday, January 15, 2009

Google Currency Conversion API

Well, the api is pretty straight forward.  
I stole it from the Curreny Conversion gadget from IGoogle.

Here is the example:

Here is templage in php:
$amount = "100";
$from_Currency = "EUR";
$to_Currency = "AUD";

$query_URL = "$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}

That is all I know for now.


Rizwan said...

Thanks Brother for posting this here.
It helped em alot

John Kelly said...

Thanks man! How did you find this? Is their documentation somewhere?

Anonymous said...

My update :)

$amount = urlencode("100");
$from_Currency = urlencode("EUR");
$to_Currency = urlencode("AUD");
$url = "hl=en&q=$amount$from_Currency%3D%3F$to_Currency";
$rawdata = file_get_contents("".$url);
$data = explode('"', $rawdata);
$data = explode(' ', $data['3']);
$var = $data['0'];
echo $var;

outputs just a number :)

Justin W said...

Hey, here's another site I found which looks pretty easy

sasikumar said...

Nice :)

Sabri said...
This comment has been removed by the author.
Weslly said...

here's my one line solution:


Vijju said...
This comment has been removed by the author.
Vijju said...

Is the API given trail version or it is a Full version. Please reply ASAP as I'm getting problems using it for my site or please give me reply to my Email Id.(

Anonymous said...

Its free to use

Babzz said...


A huge thanks to James ...

To the publisher...:D

It works..

Softmatrix Technologies said...
This comment has been removed by the author.
Syntaqx said...

This method has been implemented into a google package for the FuelPHP framework. I hope you can either use it within Fuel, or you can port it into your own system.


Balz said...

NOTE: somebody posted a comment earlier of a service which is a commercial API !

Kish said...

But if you try to find IDR rate I cant split rate.
{lhs: "1 U.S. dollar",rhs: "9 090.90909 Indonesian rupiahs",error: "",icc: true}

Now can I get rate upto four decimal places.

If try to do it , it only returns 9 .
Plz help

Umair Aslam Bhatti said...

Awesome work , nice effort by author . I modified it a little on .net and make a function if any one need it then can get from

I make it in C# it need three arguments
This update is on .net 3.5

hava said...

Seems it shows 2 results eg:
ans os on, what whould that mean, sell/buy?

Marky Mark said...

Not sure what the deal is.

For me, when I refresh numerous times it didnt toggle between the two values, it randomly selected one of three values.

It looks more like the requests are each is handled by different servers, one of which hasnt yet updated (which is a bit crap).

apple said...

Currency conversion is very important to us, so we must be updated about this. Thanks for sharing this, it really help a lot.

Philippine Peso Exchange Rate