Stock Quote Display PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m u r
Forum Newbie
Posts: 10
Joined: Sat Jun 02, 2007 2:58 pm

Stock Quote Display PHP

Post by m u r »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


This piece of php script used to display a stock quote worked beautifully up until a couple weeks ago. I can't figure out why seeing as the yahoo url still downloads the information. Any ideas?

Code: Select all

<?php
$ch = curl_init();


curl_setopt( $ch, CURLOPT_URL, 'http://quote.yahoo.com/d/quotes.csv?s=AAPL&f=sl1d1t1c1ohgv&e=.csv' );
curl_setopt( $ch, CURLOPT_HEADER, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );


$output = curl_exec( $ch );
curl_close( $ch );


$contents = explode( ',', str_replace( '"', '', $output ) );


echo "<p>AAPL stock: <b>\$$contents[1]</b> ( $contents[4] )</p>";
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

How is it "not working?"
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

Post by jeffery »

m u r
Forum Newbie
Posts: 10
Joined: Sat Jun 02, 2007 2:58 pm

Post by m u r »

Thank you!!!
Post Reply