i need php coding for convert the USD TO ALL LOCAL CURRENCY.i find the lot of link stock overflow but they not working .especially this(https://www.google.com/finance/converter?a=$amount&from=$from&to=$to) link not working kindly give the solution of my problem
Asked
Active
Viewed 198 times
1 Answers
0
It's a simple method to convert currency in php using google API
function currencyConverter($from_currency, $to_currency, $amount) {
$from_Currency = urlencode($from_currency);
$to_Currency = urlencode($to_currency);
$encode_amount = urlencode($amount);
$get = file_get_contents("https://www.google.com/finance/converter?a=$encode_amount&from=$from_Currency&to=$to_Currency");
$get = explode("<span class=bld>",$get);
$get = explode("</span>",$get[1]);
$converted_currency = preg_replace("/[^0-9\.]/", null, $get[0]);
return $converted_currency;
}
For more details about Currency Converter

Bilal Ahmed
- 4,005
- 3
- 22
- 42
-
this is not working @billal ahmed – kalaivanan Oct 09 '18 at 06:38