Your Ad Here

 Navigation
Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Books
Sample Chapters
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links




 Sponsors
 Links
low cost magazines
domain names
gambling sites
 Downloads
dzphp editor
EasyPHP
mysql_phpgenerator
php-studio-trial
phpdesigner_7_2_5
phpMyAdmin-3.4.3.2
/phptriad2-2-1
phpxedit_321
rapidphp 2011
WampServer2.1d-x64
WampServer2.1e-x32
xampp-win32-1.7.4-VC6-installer
xampplite-win32-1.7.3
 Misc
Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming

Valid XHTML 1.0 Transitional


Valid CSS!


Stock ticker lookup


Stock ticker lookup

OK you have used the quote scripts on this site and they work well but they have one problem , you must know the ticker symbol in advance . We solve this problem with the following script which uses another of yahoo's useful services . In this example we enter a company name (this could come from a form with a bit of modification) and then we display the results on the page .

Here is the script

<?php
//this is the company you wish to lookup
$company = "ntl";
//this is the url from yahoo + the company
$url = "http://quote.yahoo.com/l?m=&s=" . $company . "&t=";
//open the url and store in $fp
$fp = fopen($url , "r");
//read 20000 bytes of the file
$readfile = fread($fp , 20000);
//search for the HTML below and store everything in between in $content
$readfile = ereg("<TABLE border=0 cellPadding=2 cellSpacing=0 width=100%>(.*)<small>Add</small>" , $readfile, $content);
//display the results in a table
echo "<table width = '100%'>";
echo "$content[1]";
echo "</table>";
//close the file handle
fclose($fp);
?>

And here is the output

Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /home/beginne/public_html/tickerfind.php on line 201

Warning: fopen(http://quote.yahoo.com/l?m=&s=ntl&t=) [function.fopen]: failed to open stream: no suitable wrapper could be found in /home/beginne/public_html/tickerfind.php on line 201

Warning: fread(): supplied argument is not a valid stream resource in /home/beginne/public_html/tickerfind.php on line 203

Warning: fclose(): supplied argument is not a valid stream resource in /home/beginne/public_html/tickerfind.php on line 211




Books
 Sponsors


 Random Code
US population(internet)
a better example of counting the amount of words in a string(string)
display mysql server information(database)
 Random Article
  Network
Programming resources
Tutorials directory
Hosting resources
ASP site
Domain names
Progged
Maxi directory
bigarticle : free articles
A Code
Code N Tutorials
Get PHP
Programmers help




beginners PHP Copyright © 2004 onwards by beginnersPHP.