>I am getting data froma website for stock information. If I type in the
>brower the URL I get a text file display list this;
>
>Date,Open,High,Low,Close,Volume
>16-Jul-02,7.92,8.10,7.68,7.82,605500
>15-Jul-02,7.98,8.02,7.59,8.02,577200
>12-Jul-02,7.80,8.00,7.57,7.95,411100
>11-Jul-02,7.82,7.94,7.34,7.80,802400
>
>Now I want to break each line and then seperate each line by the commas. The
>amount of linesin the file is never known so I assume I have to use
>something like a foreach or while statement,but I am not sure the best way
>to do it. This is what I have so far.
>
> $Symbol = "IKN"; $LookupUrl =
>"http://demos.inxdesign.com/download?sym=$Symbol&format=.txt";; $Results =
>implode('', file("$LookupUrl"));
> $Data = array(); split("\n", $Results) = array_push($Data, $line)

file() is already *GIVING* you an array of each line.

You simple need to look at each one and separate by commas.

$data = file($LookupUrl);
while(list(,$line) = each($data)){
  $values = explode(',', $line);
  var_dump($values);
}

-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to