Hello, all
I want to implement the required portfolio function and print out the customers related symbol name, symbol buyin price ,symbol quantity, symbol last trade price, the changes etc
But i found some issues with it.
Here is my code:

//fetch the element from mysql
      while ($row = mysql_fetch_assoc($result1))
      {
        //change them to the uppercase
        $symbol = strtoupper($row['item_name']);
        $url="http://download.finance.yahoo.com/d/quotes.csv?s=".$symbol."&f=sl1d1t1c1ohgv&e=.csv";
        if (!(@$fd = fopen($url,"r")))
        {
            echo "ERROR: cannot open url:".$url."\n";
        }
        $rawdata= fread($fd, 1000);
        fclose ($fd);
    }

And i got the following error information:

ERROR: cannot open url:http://download.finance.yahoo.com/d/quotes.csv?s=GOOG &f=sl1d1t1c1ohgv&e=.csv

Warning: fread(): supplied argument is not a valid stream resource 

Warning: fclose(): supplied argument is not a valid stream resource

I have no idea what's the wrong with the code and tried many ways to implement it.
There do have one way will no Error show up:
it is change the code:

$url="http://download.finance.yahoo.com/d/quotes.csv?s=".$symbol."&f=sl1d1t1c1ohgv&e=.csv";

to

$url="http://download.finance.yahoo.com/d/quotes.csv?s=GOOG&f=sl1d1t1c1ohgv&e=.csv";

Just give it the exactly name and it will make it works really well.

Many thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.