Parse all lines of a txt file into an array..
$ary = explode("\n", $results);
-Kevin

----- Original Message -----
From: "Chris Crane" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 17, 2002 11:16 AM
Subject: [PHP] Someone Help please


> 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)
>
> The end result I am trying to get is each line to be an element in an
array.
> Later I will go back and stepthrough each element of the array and then
> split that by the commas and have it output into an HTML table.At least
this
> is the best way I can think to deal with it. I suppose a better way to do
> this would be to make this an associative array and have the data of each
> line be associated with the date then I could producea variable something
> like $StockData[16-Jul-02][value], but I don't know how to do any of that.
>
>
>
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to