Google's Currency Converter and JSON API
You can believe it; because its Google's Currency Converter Calculator. It can be used to see changes live for currency and foreign exchange rates with this free currency converter.
Here is the Google's Currency Converter
Open JSON API
Good news is here - Google have a secrete API for Currency Conversion. Its a simple open API you can use for all type of foreign currencies.
How to use it?
If you want currency converter £ to dollars, use it like this -
http://www.google.com/ig/calculator?hl=en&q=1GBP=?USD
If you want to calculate currency converter $ to £ -
http://www.google.com/ig/calculator?hl=en&q=1USD=?GBP
You can change value of input currency, for example you want to know the value for $100 in India Rupees
http://www.google.com/ig/calculator?hl=en&q=100USD=?INR
Working ready script
Hope you enjoyed the post, I am on twitter @motyar.Labels: api, json, Web-service
By : Motyar+ @motyar23 comments
Piotr Nalepa says…
rtg says…
says…
Thanks a lot for this, very helpful!
Nhan Sam says…
Himanshu Yadav says…
says…
Brian says…
{lhs: "1 U.S. dollar",rhs: "0.991099923 Canadian dollars",error: "",icc: true}
But, that string should have quotes around the lhs, rhs, error, and icc in order to be valid JSON.
Rumen Georgiev says…
var result = {};
for(var i in lines){
var kv = lines[i].split(":");
result[kv[0]] = kv[1].trim();
}
console.log(result);
says…
That is I want to capture the value({lhs: "1 British pound",rhs: "1.6069 U.S. dollars",error: "",icc: true}) returned from the URL inside a textbox
Ketan says…
I was very confused regarding currency conversion in my php project.
Now it will be solved
gooday says…
http://pastebin.com/P7BpL019
dskanth says…
For example, i tried this URL:
http://www.google.com/ig/calculator?hl=en&q=1USD=?LBP
The "rhs" in json response (rhs: "1 506.0241) contains a special character of space (Â). How can i strip that and get the original value (1 506.0241) ?
timen chad says…
http://www.google.com/ig/calculator?hl=en&q=0.1USD=?LBP
it won't be an space character if the result under 1k.
Hyacinthus Chu says…
Dheeraj says…
vipul says…
Kuba says…
Nils Juenemann says…
Bhavik Tailor says…
Can I use it for my commercial website?
Money Exchange says…
Sadèé says…
$replace = array(
'lhs' => '"lhs"',
'rhs' => '"rhs"',
'error' => '"error"',
'icc' => '"icc"'
);
$json_string = file_get_contents("http://www.google.com/ig/calculator?hl=en&q=1GBP=?LKR");
$json_string = str_replace(array_keys($replace), array_values($replace), $json_string);
$parsed_json = json_decode($json_string);
$output = $parsed_json->{'rhs'};
echo $json_string."
";
echo "Current temperature in 1 GBP = ${output} LKR \n";
Thanx Motyar! (Y)


Post a Comment