Forum Moderators: coopster

Message Too Old, No Replies

Plain text parsing help needed

         

youevolve

4:41 pm on Jun 10, 2008 (gmt 0)

10+ Year Member



I am parsing a plain text document which is updated every 15 minutes. I'm just learning PHP and have worked up to the point where I can download the document and parse the last line. However, I need a specific field from the line and am lost on how to parse that.

The line returned is (for example):

2008 06 10 1615 0 2008 06 10 172308 1.67 68.1 -1.00

I need whatever number is in the position where 1.67 is in the example. Any insight is appreciated.

Thanks!

OutdoorWebcams

4:54 pm on Jun 10, 2008 (gmt 0)

10+ Year Member



You might try:

$numbers = explode(" ", $textline);
$yournumber = $numbers[9];

(If the numbers are always at the same position and $textline represents your example line.)

youevolve

5:08 pm on Jun 10, 2008 (gmt 0)

10+ Year Member



Thanks for the quick reply! I'll try that. The needed value is indeed in the same position every time.