PHP Currency conversion using yahoo finance
Ok, I have some code that was working a few days ago on my family website and now it is not. This is our primary means of support and I need answers as fast as possible. I really appreciate any answer you can give me. I am wondering if something is wrong on Yahoo's end or if they have changed the site in some way. What I am trying to do is pull a currency rate into my website, so that I can change the currency on the site to a currency of choice at the current rate.
This is the code I have been using, does anyone have any information why it is not working now?
<?php
$from2 = 'USD'; //US Dollar
$to2 = 'AUD'; //to Australian Dollar
$url2 = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s='. $from2 . $to2 .'=X';
$handle2 = @fopen($url2, 'r');
if ($handle2)
{
$result2 = fgets($handle2, 4096);
fclose($handle2);
}
$audex = explode(',',$result2);
$aussie = $audex[1];
?>
I don't understand it, I have not made any changes to the site on the page that is pulling this in and it was working a few days ago. Now nothing is coming through. Has Yahoo made a change to their system. I read about a new currency converter on this site, do I need to rewrite this code now to get information from that currency converter. Please help ASAP, without this site my family has no income.
Thanks
John R Manning
by
2 Replies