views:

587

answers:

1
  1. A weekly mp3 is uploaded to an external server.
  2. I manually copy this to my server and link it for podcasting and archive etc.
  3. The external file is then replaced the following week.

I can copy the file directly to my server when available:

copy("http://source.com/file.mp3", "newfile.mp3");

I need to know when the file is available by getting other file info such as last modified so I can compare the files and copy the new file(s) only when they are updated. This works fine on my server, but not for an external source, is there an alternative?

echo filemtime($externalfile);
echo filectime($externalfile);
echo print_r(stat($externalfile));

Is it a security restriction to disallow access to this information?

I have access to the directory listing as a page, as a last resort I could access the last modified and sizes from that, but a direct solution would be better.

+3  A: 

If i understand your question correctly you can try using get_headers and looking for the last-modified portion...

Or you could use the content-length header and compare it to the size of the current weeks mp3

Galen
Thanks for that, pretty simple and works perfectly.
Peter