Hello, I'm new to this site and PHP. First let me say that I have no experience with PHP whatsoever apart from simple include() and require() statements. Here is my problem, I want to have current weather conditions on my website, but I have searched all of the ready made PHP weather scripts out there and I don't like any of them so I want to create my own. Now, the data I want to use resides in a text file on the weather.noaa.gov server. The file looks like this:
Code: Select all
Broken Bow, Broken Bow Municipal Airport, NE, United States (KBBW) 41-26N 099-39W
Jan 11, 2005 - 10:53 PM EST / 2005.01.12 0353 UTC
Wind: from the SSE (160 degrees) at 8 MPH (7 KT):0
Visibility: 2 1/2 mile(s):0
Sky conditions: overcast
Weather: mist
Temperature: 17.1 F (-8.3 C)
Windchill: 6 F (-14 C):1
Dew Point: 16.0 F (-8.9 C)
Relative Humidity: 95%
Pressure (altimeter): 29.59 in. Hg (1002 hPa)
ob: KBBW 120353Z AUTO 16007KT 2 1/2SM BR OVC002 M08/M09 A2959 RMK AO2 SLP057 T10831089
cycle: 4
The contents of the text file looks exactly as above, meaning the carriage returns are there and everything. Now I would like to use PHP (or JavaScript) to select the items I want out of this file (such as only Temp, Sky conditions, windchill, etc..) I do not need all of the weather serial numbers or the other unusable data. The other thing I would like to do is put HTML formatting into the output such as have the labels be bold and a different color than the values and have the results in a table. Now since I am new to PHP, I don't know if what I want to do is hard, easy, or even possible, but I hope somebody on here can help me out. Also, the text file will have to be downloaded every time the page is loaded from
ftp://weather.noaa.gov/data/observation ... d/KBBW.txt Is there a way I could some how cache the data for say an hour at time so that page opens wouldn't be delayed every time from having to download the file via FTP? Please help. Thanks.
Louie