It's XML output from the NWS. Here is a URL with an example near my home:
http://www.wrh.noaa.gov/forecast/xml/xml.php?duration=168&interval=6&lat=37.2&lon=-122.0This page seems to have some interesting properties:
- It is in a standard XML format. So it won't be subject to the kind of changes seen when scripts scrape info from web-pages.
- It contains enough information that a standard set of icons and some table formatting, when combined with this output, could allow us to make a pretty detailed '5 or 7 day forecast' page.
If there is no script available to parse this, I am tempted to write one, over the next while (time is not always available to me), that would be in multiple parts:
1) Read the forecast every few hours (for those websites with cron capability), or at explicit stimulation by a function call via a web-page include. (You could have something on a windows box that goes to a url of your choice periodically). The forecast would be read and put not into a table but would generate a PHP script that contained the XML output, with the following additions, in a series of arrays:
day of week in local time zone, as best as PHP can determine it from UTC
day of month in local time zone, as best as PHP can determine it from UTC
month of year in local time zone, as best as PHP can determine it from UTC
year in local time zone, as best as PHP can determine it from UTC
hour in local time zone, as best as PHP can determine it from UTC
minute in local time zone, as best as PHP can determine it from UTC
suggested icon to use from the Carter Lake set that everyone seems to use. (this will be the trickiest part and most subjective. At what point is 'rain likely' vs. 'rain possible' vs. 'slight chance of rain'
textual description of the forecast for this line. (this also will be tricky as it's subjective in some ways)
2) A script, that on being included, generates the typical 'row of graphics + text underneath' that weather websites have
3) A script, that on being included, generates a textual form of the above, as a series of lines.
Maybe #2 and #3 should be parts of #1, with the 'forecast graphics+small text row' and the 'text forecast list' generated one time, and those final results calculated... with a new pair of scripts that utilizes that information... dunno...
But before I even consider beginning this, I am curious as to if this already exists, and if it doesn't, if anyone else would find this useful. This will also be me teaching myself PHP (I know other languages quite well, this part looks fairly straightforward).