Getting part of text file using PHP

Hey guys and girls. I need to get only 3 little sections of this .txt file here http://weather.noaa.gov/pub/data/observations/metar/decoded/CYYZ.TXT

This file updates every hour with the latest weather conditions and I need to have
Temperature:
Sky Conditions:
Weather:
separated and echoed as a just plain text however I am at a loss how to do this…I know an extremely long way which is defining each temperature and sky condition possible however that would take a large amount of time. Any ideas on how I could do this?

Thanks, Dave

If you make an attempt and post some code I will help you out.

Well, you can read the file into a string and then use string commands to search for them.
You could read each line one at a time and check for your temp and other items as the first part of the line
and then use string functions to strip off the rest. Lots of ways to do this.

Here is a link to the PHP manual’s string functions:
http://php.net/manual/en/ref.strings.php

Hope that helps!

Sponsor our Newsletter | Privacy Policy | Terms of Service