Re: [PHP] File reading help with Syntax

2002-07-17 Thread Analysis & Solutions

On Wed, Jul 17, 2002 at 10:00:29AM -0400, Chris Crane wrote:
> 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

So, now you're working an another approach to the stock quote question, 
eh?

Use these functions:
   fopen()
   fgetcsv()

Look at the manual on how to use them.  If, for some reason, that's not 
clear, check out the archives for this list on http://groups.google.com/.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




[PHP] File reading help with Syntax

2002-07-17 Thread Chris Crane

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