I'm sure there is some sort of free XML feed for stock quotes out there, but I wasn't able to find one. Yahoo finance has the ability to download up to date stock data (with the normal 15 minute lag) to a CSV file. So, let's say we wanted a stock quote for Yahoo... First, go to Yahoo finance's page for whatever company you want a quote for: http://finance.yahoo.com/q?s=YHOO Under the stock figures, there is a download data option. Use that URL in the fopen() function below. echo "Stock quote: "; $handle = @fopen("http://finance.yahoo.com/d/quotes.csv?s=YHOO&f=sl1d1t1c1ohgv&e=.csv", "r"); $data = @fgetcsv($handle, 1000); @fclose($handle); echo "<B>" . $data[1] . "</B> "; if ($data[4] < 0) { echo "<FONT COLOR=RED>" . $data[4] . "</FONT>"; } elseif ($data[4] > 0) { echo "<FONT COLOR=GREEN>" . $data[4] . "</FONT>"; } else { echo $data[4]; } echo " (" . date ("M j, g:i a", strtotime($data[2] . " " . $data[3])) . " EST)"; PHP: Ta-da! You now have a stock quote that is "live". - Shawn
I am also interested i making a stock ticker, and i found that you could get even more than just the quote, if you use the right tags. check out this page: -- I can't post the link because i'm too new, but you can google, "yahoo data download" it will be the first page--- it has a whole bunch of other info you can get from yahoo. such as a 200-day or 50-day moving average.
LoL, i didnt notice it at all, just noticed it when i read your post and checked when its posted, how did he even found the thread??
hi everybody... i'm the webmaster of www .fanta-trade.eu it is a game/community based on stock markets. i'm using yahoo as data provider as well, but i would like to skip those 15 min of delay. do you know any data provider that give prices in "real" real time ? also for the europeans markets may be... thanks
Just found a great blog post at the useful php blog explaining how to do exactly this! http://usefulphp.blogspot.com/2010/04/stock-quotes-with-php.html Very nicely done too - uses the Yahoo CSV service and returns a php array with all the info you need about the stock quote.
Hi Guys, I want just tell you that you do you can also find through google by typing "Incorporate real time stock quote" or you may found so many sites which provide Incorporate real time stock quote. Instead of writing code you have to take a simple way through google.