rick <rb*****@spamfree.net> wrote in message news:<ioFjd.60743$HA.8985@attbi_s01>...
Hi everyone...
I am looking to write code that can read a file from an http address
(for example: http://www.somesite.com/document.xml) and check it for any
changes (an updated state) then download it if it is a newer version. I
have seen references to the http-get functionality of PHP , but can't
find any examples or tutorials. Apparently I can check some http
headers to determine whether the document is new or not?
Perhaps <http://in.php.net/get_headers>. Look at Last-Modified and
ETag headers. The code for PHP 4 is at usernotes and it seems to be
faster than the function itself, but it doesn't handle redirects.
If the server doesn't send Last-Modified and ETag headers, the only
option is to md5_file() <http://in2.php.net/md5_file> the whole body
and check for freshness with the saved hash.
filemtime() will definitely not work for remote files.
--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com