Adding a php script to a site and cant get it to display the quote.. wonderin if anyone has some insight? Whats happening is it displays like this... When I want the N/A to Show quotes MSFT N/A Day high N/A Day low N/A Thanks in advance <?php $MSFT=GetQuote("MSFT"); ?> <h1>Stock quote</h1> <p> <table width="90%" border="0" cellpadding="1" cellspacing="0"> <tr> <td width="50%"><a href="http://finance.yahoo.com/q?s=MSFT" target="_blank"><strong>MSFT </strong></a></td> <td width="15%" align="right"><a href="http://finance.yahoo.com/q?s=MSFT" target="_blank" class="stockLink"> <?php print((isset($MSFT['Last_Traded_Price']) && trim(chop($MSFT['Last_Traded_Price']))!="")? $MSFT['Last_Traded_Price']: "N/A"); ?></a></td> </tr> <tr> <td><a href="http://finance.yahoo.com/q?s=MSFT" target="_blank">Day high</a></td> <td align="right"><a href="http://finance.yahoo.com/q?s=MSFT" target="_blank"> <?php print((isset($MSFT['Days_High']) && trim(chop($MSFT['Days_High']))!="")? $MSFT['Days_High']: " N/A"); ?></a></td> </tr> <tr> <td><a href="http://finance.yahoo.com/q?s=MSFT" target="_blank">Day low</a></td> <td align="right"><a href="http://finance.yahoo.com/q?s=MSFT" target="_blank"> <?php print((isset($MSFT['Days_Low']) && trim(chop($MSFT['Days_Low']))!="")? $MSFT['Days_Low']: "N/A"); ?></a></td> </tr> </table> </p> </div>
Is GetQuote a function you wrote yourself? or is it a function you downloaded from somewhere. It is clear that it is not reading the quote properly, but it is hard to troubleshoot it without knowing what the function is attempting to do, and where it is fetching the quotes from (presumably RSS or XML). Chances are the function is trying to fetch a quote from an XML feed that either no longer exists, or has been restructured since the time of the function being written.
Sorry forgot to add that.. near the top of my php I have function GetQuote($Symbol="MSFT") { $url="http://download.finance.yahoo.com/d/quotes.csv?s=MSFT&f=sl1d1t1c1ohgv&e=.csv"; }
I think the issue may be that they used to label their fields on the csv and they stopped doing that... sound right?