This tool is a currency converter using yahoo finance data. Enter the initial value with its original currency, and the desired final currency.
Yahoo Finance : http://finance.yahoo.com
Details are shown below.
http://api.key-ative.com/finance/convert/v1
a - Amount
f - Currency Code(ISO 4217) which you have.
t - Currency Code(ISO 4217) which you want to convert.
When requested with POST or GET method I will return a JSON response. Here's is sample.
{
"amount": 1,
"from": "THB",
"to": "USD",
"result": 0.0299,
"error": false,
"status": 200
}
$curl "api.key-ative.com/finance/convert/v1?a=1&f=THB&t=USD"
{
"amount": 1,
"from": "THB",
"to": "USD",
"result": 0.0298,
"error": false,
"status": 200
}
Here's a jQuery example.
$.get("http://api.key-ative.com/finance/convert/v1",
{a:1,f:"THB",t:"USD"},
function( data ) {
console.log(data);
},"json");
Here's a PHP code example.
Option 1
$url = "http://api.key-ative.com/finance/convert/v1?a=1&f=THB&t=USD";
$json = file_get_contents($url);
if($json){
$data = json_decode($json);
var_dump($data);
}
Option 2
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://api.key-ative.com/finance/convert/v1");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"a=1&f=THB&t=USD");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec ($ch);
curl_close ($ch);
$data = json_decode($json);
var_dump($data)