|
|
| <?php
//this is the url of our csv file
$url = "http://finance.yahoo.com/d/quotes.csv?s=^DJI&f=sl1d1t1c1ohgv&e=.csv";
//open it for reading
$fp = fopen($url , "r");
//if no connection exists display error message
if (!fp) {
echo "could not connect to the site";
}else {
//store the csv file info in the array $data
$data = fgetcsv($fp,1000,",");
//close the file
fclose($fp);
?>
<table>
<tr><td>description</td><td>latest figure</td><tr>
<tr><td>Market</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>
</table>
<?php
}
?> | | |
|
| grab the result of any calculation you submit to the Google Calculator. Categories : PHP, Arrays, Web Services, Regexps, Math. | | | How to Get a character array from a string Categories : PHP, Strings, Arrays | | | PHP Array to Javascript Object Categories : PHP, Arrays, Java Script | | | Parse string to find sub-string between two arbitrary strings Categories : PHP, Strings, HTML and PHP, Arrays | | | A simple bubblesort that takes 2 arrays as argument.The first one is the actual data used for sorting, the second is data that will "tag along" with the first array, for instance a descriptive text about the data in the first array. Categories : Algorithms, Arrays, PHP, Complete Programs | | | Dynamic Loading of XML array data into ComboBox and Display XML data using PHP + DOM + Javascript. Categories : PHP, Java Script, DOM XML, XML, Arrays | | | Simple SOAP Example (with SoapClient) Categories : PHP, Web Services, SOAP, Beginner Guides | | | clearing variables in php3 Categories : Variables, Arrays, PHP | | | Select with current month Categories : PHP, HTML and PHP, Date Time, Arrays | | | Parsing html tags with php. Get an array from this function Categories : PHP, HTML and PHP, Arrays, Tag Extractors | | | Sort the results from a SELECT query (any number of columns) into an array automatically. Categories : PHP, PHP Classes, Arrays, Databases, MySQL | | | navbar.php3 - Dynamic hyperlinked navigation bars Categories : HTML and PHP, Arrays, PHP, Complete Programs | | | Display list of files within current and subdirectories (recursively) showing
each file as an anchored link and each directory as a category header. Categories : Filesystem, Directories, Arrays, PHP | | | Check for functional file links (broken Files)
Categories : PHP, Data Validation, FTP, Regexps, Arrays | | | Single-file PHP news system with automatic folder structure creation Categories : PHP, Filesystem, Arrays | |
| |
| |
|