It appears that BOC has changed their data feeds.
Code:function quote_boc_currency($currencyCode = '', $base = DEFAULT_CURRENCY) { if ($currencyCode == $base) return 1; static $CSVContent; $requested = $currencyCode; $url = 'http://www.bankofcanada.ca/stats/assets/csv/fx-seven-day.csv'; $currencyArray = array(); $currencyArray['CAD'] = 1; if (!isset($CSVContent) || $CSVContent == '') { $CSVContent = file($url); if (! is_object($CSVContent) && function_exists('curl_init')) { $CSVContent = doCurlCurrencyRequest('GET', $url); $CSVContent = explode("\n", $CSVContent); } } foreach ($CSVContent as $line) { if (substr($line, 0, 1) == '#' || substr($line, 0, 4) == 'Date' || trim($line) == '') continue; $data = explode(',', $line); $curName = $data[1]; $curRate = $data[sizeof($data)-1]; $currencyArray[trim($curName)] = (float)$curRate; } $rate = (string)($currencyArray[DEFAULT_CURRENCY]/(float)$currencyArray[$requested]); return $rate; }
These updates will be in v1.5.1



Reply With Quote



Bookmarks