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
kathryn on I have joined litl!:
psyched to have you onboard! this team just gets more and more awesome....
Filippo on My FlashBuilder 4 color scheme.:
Flash Builder is such a powerful tool, but syntax highlighting just sucks! ...
Devi on AS3: Creating custom events:
This example is awesome...
Josh Molina on AS3: Creating custom events:
Excellent tutorial. Straight and to the point.Thank you.Jo...
connatser on Flash Player 10.1: Verifiable speed increase.:
Thanks for the comment Jackson, your blog post was great inspiration....