AS3: Yahoo Stocks via PHP Proxy
To follow a recent post about AS3 and Yahoo stocks using ColdFusion as a proxy below is some code to get the same information using PHP. I have been asked by several people on how to do this with PHP, which is not my typical scripting language. I decided to dig into it to see what the comparable method in PHP is to CFHTTP.FileContent. Turns out that the comparable function in PHP is “file_get_contents”.
<?php //Get the file content and assign the string to $teststock $teststock = file_get_contents('http://download.finance.yahoo.com/d/quotes.csv?s=^DJI&f=sl1d1t1c1ohgv&e=.csv'); //Split the string into an array to access each property of the stock $teststring = split(",",$teststock); //Print the new array to the screen print_r($teststring); print("<br /><br />"); //Print a specific point in the array, in this case the first one print_r($teststring[0]); print("<br /><br />"); //Print a specific point in the array, in this case the second one print_r($teststring[1]); ?>


Recent Comments
connatser on AS3 Playground: Simple Particles:
thanks Richard, and thanks for checking it out!...
connatser on AS3: Motion Blurring with Flash, part 1:
I agree, thanks. I will get some source files together and update the post....
Chris on AS3: Motion Blurring with Flash, part 1:
would be a lot easier to follow this tute for a beginner if you'd inclu...
rv on AS3 Playground: Simple Particles:
great example, nice job....
ericfickes on 360Flex: Stoked to get a break and hear great devs.:
Hey Brian, be sure to say hi at 360. Jun and I are pretty excited about th...