Subscribe via Email

Enter your email address to subscribe and receive notifications of new content by email.

Yahoo stock quote example

Yahoo stock quote example

//stock quote script
//this is the url for Microsoft’s stock quote , we are opening it for reading
$fp = fopen (“”,”r”);
//this uses the fgetcsv function to store the quote info in the array $data
$data = fgetcsv ($fp, 1000, “,”)

<!– this is our table which displays the stock info –>
<!– we access the individual items by using $data[0]–>

<tr><td>description</td><td>latest figure</td><tr>
<tr><td>symbol</td><td><?php echo $data[0] ?></td></tr>
<tr><td>last price</td><td><?php echo $data[1] ?></td></tr>
<tr><td>date</td><td><?php echo $data[2] ?></td></tr>
<tr><td>time</td><td><?php echo $data[3] ?></td></tr>
<tr><td>change</td><td><?php echo $data[4] ?></td></tr>
<tr><td>open</td><td><?php echo $data[5] ?></td></tr>
<tr><td>high</td><td><?php echo $data[6] ?></td></tr>
<tr><td>low</td><td><?php echo $data[7] ?></td></tr>
<tr><td>volume</td><td><?php echo $data[8] ?></td></tr>

//close the filehandle $fp
fclose ($fp);

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInWhatsAppBibSonomyDeliciousDiggDiigoSina WeiboWordPressBlogger PostShare

15 comments to Yahoo stock quote example

Leave a Reply





You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>