Jump to content

Little help with extract?


ridiculous

Recommended Posts

Hi. I'm trying to convert this array into variables using extract. I've read throught the PHPmanual and I'm having trouble matching this script to the manual.

 

Maybe a kind soul could show me the light.

 

 

 

 

 

 

 

 

<?
Class quote{
        function get($symbol){
            $url = sprintf("http://finance.yahoo.com/d/quotes.csv?s=%s&f=sl1d1t1c1ohgv", $symbol);
            $fp = fopen($url, "r");
            if(!$fp){
                echo "Error: Cannot connect";
            } else {
                $array = fgetcsv($fp, 4096, ',');
                fclose($fp);
                $this->symbol = $array[0];
                $this->last = $array[1];
                $this->date = $array[2];
                $this->time = $array[3];
                $this->change = $array[4];
                $this->open = $array[5];
                $this->high = $array[6];
                $this->low = $array[7];
                $this->volume = $array[8];
            }
        }
    }
?>

Link to comment
https://forums.phpfreaks.com/topic/40471-little-help-with-extract/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.