[thelist] Using PHP to read and cache XML feed

Pringle, Ron RPringle at aurora-il.org
Wed Oct 18 10:44:45 CDT 2006


I've returned once again to messing with the National Weather Service's XML and RSS feeds of local weather data.

In a nutshell what I want to do is, using PHP5, grab the feed from the NOAA site, temporarily cache it for one hour, parse the data and output it to a webpage. If the data isn't cached or the cache is expired, grab the feed from NOAA again.

I've found a few items about reading in XML using PHP, particularly this article at SitePoint [0], and it makes sense to me, more or less.

What I'm having a hard time finding info about, or at least information I can understand, is on caching the xml file.

Has anyone done anything similar? Doesn't have to be weather data, but caching a file, and/or outputting an XML file to HTML. Any code, hints, links to info on the PHP site or links to examples of either/or would be greatly appreciated.

Thanks!

Ron



More information about the thelist mailing list