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
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...
shiv on AS3: Creating custom events:
ThankU very much.This helped me a lot in understanding this concept....
connatser on Flash and FDT: Simple workflow video:
Thanks Lee, that's cool to here about the new features with FB4, Bridge...
Lee Probert on Flash and FDT: Simple workflow video:
you could use ANT to automate the publishing of the FLA.New FlashBu...
Wouter on Flex Framework: RobotLegs simple demo:
thanks for this! It helps to get started with RobotLegs. I started working ...