WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Stock quotes from yahoo!
Categories : PHP, Web Services, Arrays Click here to Update Your Picture
glen mc arthur
Date : Nov 18th 2005
Grade : 1 of 5 (graded 5 times)
Viewed : 6224
File : No file for this code example.
Images : No Images for this code example.
Search : More code by glen mc arthur
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?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
}
?>



file class , uploade file , download file already uploaded on another website
Categories : PHP, PHP Classes, Filesystem, Web Services
clearing variables in php3
Categories : Variables, Arrays, PHP
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
Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
Categories : PHP, Directories, Variables, Arrays
XML To Array
Categories : PHP, PHP Classes, XML, Arrays
BBCode Formatting String
Categories : PHP, HTML, Regexps, Arrays
Array Insertion
Categories : PHP, PHP Classes, Arrays
PHP Script to find url links in a page
Categories : PHP, URLs, Regexps, Arrays
Tag content retrieval from websites with preg_match
Categories : PHP, Regexps, Arrays, HTML and PHP
Array values from javascript to php
Categories : PHP, Java Script, Arrays
Weighted Random - Random Scripts usually chose one out of each item, and each item have an equal chance to be chosen. But what if you want an item to be chosed more frequently than other?
Categories : PHP, Math., Arrays
This gets the http response headers for a given url and returns them in an assoc array. i.e. to test if a url exists: $array = get_http_headers($url); if($array[result]=200) { }
Categories : HTTP, Arrays, PHP
Beginners Array Functions
Categories : PHP, Beginner Guides, Arrays
How to pass an array from one PHP Script to another via an HTML form
Categories : PHP, HTML and PHP, Arrays
How to load a query result into a PHP Array
Categories : PHP, Databases, Arrays, MySQL