Server copy of XML file
Posted: Fri Oct 10, 2008 12:49 pm
Hi there. Sorry if this question has already been asked. Its a bit abstract so I couldn't think what to search for.
Basically, I have a small script which downloads a remote XML file, strips out some relevant data, and displays it in HTML. All well and good, but the thing is that the script downloads the XML file each time the page is loaded, which means that potentially, the XML file could be downloaded rather a lot of times, creating excessive bandwidth usage and possible having my server's IP banned from the XML source. Being new to PHP, I don't really know the best way of circumventing this problem. I would have thought that having some sort of background script to keep a server copy of the XML file updated, and then having the script retrieve its version from there would be a reasonable approach. Is this possible? Can a script be set some how to run constantly in the background? Alternatively, perhaps I could somehow have the script check a timestamp on the server copy of the XML file, and if it is old, instruct the server to refresh it...although I don't know how the script would know that the XML file was old without downloading a newer version and checking timestamps.
Any ideas on this would be much appreciated.
shaw2thefloor
Basically, I have a small script which downloads a remote XML file, strips out some relevant data, and displays it in HTML. All well and good, but the thing is that the script downloads the XML file each time the page is loaded, which means that potentially, the XML file could be downloaded rather a lot of times, creating excessive bandwidth usage and possible having my server's IP banned from the XML source. Being new to PHP, I don't really know the best way of circumventing this problem. I would have thought that having some sort of background script to keep a server copy of the XML file updated, and then having the script retrieve its version from there would be a reasonable approach. Is this possible? Can a script be set some how to run constantly in the background? Alternatively, perhaps I could somehow have the script check a timestamp on the server copy of the XML file, and if it is old, instruct the server to refresh it...although I don't know how the script would know that the XML file was old without downloading a newer version and checking timestamps.
Any ideas on this would be much appreciated.
shaw2thefloor