Your Ad Here

 Navigation

Home
Source code
Tutorials
RSS feeds
Articles
Books
Software
Downloads
Hosting
manuals
Forums
Script directory
Training
Our Links

 Sponsors
 Links
gambling sites
domain names
software directory
 Downloads
 Misc

Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming



Get stock quotes


Get stock quotes

This shows how to display stock quotes on your website using Yahoo service . This was submitted by an anonymous person to us and is a great example . In this example for those of you that are interested the symbol is MSFT which is Microsoft.

Code

<?php
Class yahoo
{
function get_stock_quote($symbol)
{
$url = sprintf("http://finance.yahoo.com/d/quotes.csv?s=%s&f=sl1d1t1c1ohgv" ,$symbol);
$fp = fopen($url, "r");
if(!fp)
{
echo "error : cannot recieve stock quote information";
}
else
{
$array = fgetcsv($fp , 4096 , ', ');
fclose($fp);
$this->symbol = $array[0];
$this->last = $array[1];
$this->date = $array[2];
$this->time = $array[3];
$this->change = $array[4];
$this->open = $array[5];
$this->high = $array[6];
$this->low = $array[7];
$this->volume = $array[8];
}
}
}
$quote = new yahoo;
$quote->get_stock_quote("MSFT");
echo ("<B>$quote->symbol</B><br>");
echo ("<B>$quote->time</B><br>");
echo ("<B>$quote->date</B><br>");
echo ("<B>$quote->last</B><br>");
echo ("<B>$quote->change</B><br>");
echo ("<B>$quote->high</B><br>");
echo ("<B>$quote->low</B><br>");

?>




Books
 Sponsors
 Random Code
Search a text file(string)

Check number of characters(string)

grab a web page with cURL(internet)

 Random Article
  Network

Programming resources
Tutorials directory
General bid directory
sell software, make money
Find me wholesalers
Find me dropshippers
Free recipes online/a>
UK products and price comparison
Anime videos
Free lyrics search
free stuff
UK stores
Gambling directory
Sexy free wallpapers
Hosting resources
ASP site
Golf resources
iPod resources
Coupons and deals
Baby names
Domain names
Dating site
Scripts directory
Maxi directory
bigarticle : free articles
dawgwitch search
List of directories






beginners PHP Copyright © 2004 onwards by beginnersPHP.