i want to convert currency from USD to INR, the value in USD retrive from url and i want to convert it in INR according the current rate. here is the first code:
<?php
require_once('currency.php');
$val=$_GET["val"];
echo currency($val);
?>
and the second code is:
<?php
function currency($val) {
$amount = $val;
$url = "http://www.google.com/ig/calculator?hl=en&q=$amountUSD=?INR";
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$rawdata = curl_exec($ch);
curl_close($ch);
$data = explode('"', $rawdata);
$data = explode(' ', $data['3']);
$var = $data['0'];
return round($var,3);
}
?>
bytheway am testing this code on 0fees.net, the free hosting site, so is there any problem for that as am trying live USD to INR conversion.