Home | Scripts | Tutorials | Books | Hosting | Forums | Links|

Navigation:

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

ADD TO Progged Progged
ADD TO DEL.ICIO.US Del.icio.
ADD TO DIGG Digg
ADD TO FURL Furl
ADD TO NEWSVINE Newsvine
ADD TO NETSCAPE Netscape
ADD TO REDDIT Reddit
ADD TO STUMBLEUPON StumbleUpon
ADD TO TECHNORATI FAVORITES Technorati
ADD TO SQUIDOO Squidoo
ADD TO WINDOWS LIVE Windows Live
ADD TO YAHOO MYWEB Yahoo MyWeb
ADD TO ASK Ask
ADD TO GOOGLE Google
ADD TO MAGNOLIA Magnolia
ADD TO SPURL Spurl



 
 

SPONSORS



 
 

Improved stock ticker

This version allows users to enter the company name and it displays the corresponding ticker symbols.

Here is the updated code

<form action="<? echo($PHP_SELF); ?>" METHOD="POST">
<input type="text" name="company">
<input type="submit" NAME="action" value="Submit">
</form>
<?php
if ($action)
{
//this is the company you wish to lookup
//$company = "";
//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);
}
?>

Try it out here