Yahoo finance API does not work anymore, I would like to know how to get currency exchange rates via Google API
Yahoo finance API is being discontinued and You can use https://finance.google.com/finance/converter to get exchange rates from google finance as an alternative method
function currencyConverter($from_Currency,$to_Currency,$amount) { $from_Currency = urlencode($from_Currency); $to_Currency = urlencode($to_Currency); $get = file_get_contents("https://finance.google.com/finance/converter?a=1&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; } $converted_currency=$this->currencyConverter($currencyFrom,$currencyTo, 1);