Kobus Beets .co.za
From the daily archives: Wednesday, September 28, 2011
Here is a php function that can be used to get current currency values from Yahoo.
<?php function get_currency_value($from, $to) { $url = “http://finance.yahoo.com/d/quotes.csv?f=l1&s=$from$to=X”; $handle = fopen($url, ‘r’); if ($handle) { $result = fgetcsv($handle); fclose($handle); $rate = $result[0]; return $rate; } } echo ‘R’.get_currency_value(‘USD’, ‘ZAR’); ?>
The method, as I used it, will return 1 [...]
Archives

