0

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
  • QUOTE (John @ Nov 4 2009, 08:36 PM) <{POST_SNAPBACK}>
    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



    Well, I don't know if I arrive too late, but looking to do some improvements in my webpage (do some currency-converting maths over some figures), i got this thread, and also this reference:

    http://php-programming.suite101.com/articl...inance_from_php

    I'm not an expert, and i'm still trying to set up the code for my webpage, so i cannot check your code, but i hope it helps you, best of luck...
    0
  • John,

    I answered you on your previous thread.

    Robyn Tippins
    Community Manager, YDN
    0

Recent Posts

in PHP Development