Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 PHP Code: Display stock quotes from a CSV file Jump to:  
Category: >> PHP Code >> Display stock quotes from a CSV file Bookmark and Share

<< lastnext >>

Snippet Name: Display stock quotes from a CSV file

Description: Displays formatted stock quotes from a dynamically retrieved CSV file.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: March 01st, 2009

// URL for Microsoft's stock quote , we are opening it for reading 
$fp = FOPEN ("http://finance.yahoo.com/d/quotes.csv?s=msft&f=sl1d1t1c1ohgv&e=.csv","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); 

Oracle Magazine
and Oracle White Papers

SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 50 users online    © 2009 psoug.org

Forgot your password?