WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 Resources
Web Development Content
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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



grab the result of any calculation you submit to the Google Calculator.
Categories : PHP, Arrays, Web Services, Regexps, Math.
Simple SOAP Example (with SoapClient)
Categories : PHP, Web Services, SOAP, Beginner Guides
Sort the results from a SELECT query (any number of columns) into an array automatically.
Categories : PHP, PHP Classes, Arrays, Databases, MySQL
Amazon.com API, CURL-REST Parser. Obtain data about Amazon products (PHP5 +)
Categories : PHP, Ecommerce, XML, Web Services, CURL
Parsing html tags with php. Get an array from this function
Categories : PHP, HTML and PHP, Arrays, Tag Extractors
Takes an array and returns a string, suitable for inputing in an SQL statement
Categories : Arrays, Strings, PHP
How to Get a character array from a string
Categories : PHP, Strings, Arrays
This functions makes it easy to use session-variables known from ASP. With one Cookie the array "session" will save and restore from a db-record. In this version MySQL is used but it's should very easy to change
Categories : PHP, Arrays, Cookies, MySQL, Databases
A class to put get and post variables in hidden form elements. Works on scalars, normal arrays, associative arrays.
Categories : Algorithms, Variables, Arrays, PHP, PHP Classes
Function that returns an array with the 7 dates of the week that belong to the supplied date.
Categories : PHP, Date Time, Arrays
Single-file PHP news system with automatic folder structure creation
Categories : PHP, Filesystem, Arrays
How to pass an array to a function, or how to define a function wich recieves an array.
Categories : Variables, PHP, Arrays
This simple function will take a few arguments and easily set a associative array for each column in a result from a MySQL query
Categories : Databases, PHP, MySQL, Arrays
Print structured array with offsets
Categories : PHP, Debugging, Arrays
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel