Forum Moderators: coopster

Message Too Old, No Replies

Finding out when remote files have been modified

How can use filemtime for remote files

         

irldonalb

1:21 pm on Aug 6, 2004 (gmt 0)

10+ Year Member



Hi Guys,

Is there any way I can find out when a file on a remote web server was last modified. filemtime() only appears to work on local files and folders.

Thanks
Donal

irldonalb

1:49 pm on Aug 6, 2004 (gmt 0)

10+ Year Member



I'm still thinking about this and I originally felt it couldn't be done.

The more I think about it, I realize it has to be possible. When you go to a website and there isn't a index file a default file is loaded called 'Index of /folder_name'

This page gives you the Name, Last modified, Size and Description of each file. So the information is somewhere there for the taking.

D

coopster

2:00 pm on Aug 6, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How about using fsockopen() [php.net]? Then send a
HEAD
request and parse out the Last Modified information? Note that not all servers may be configured to send this info back to you though.

By the way, as of PHP 5.0.0 filemtime() can also be used with some URL wrappers.