Get the latest change and other file information from a remote server using PHP

  • Weekly mp3 is uploaded to an external server.
  • I will manually copy this to my server and link it for podcasting and archive, etc.
  • The external file is then replaced by the next week.

I can copy the file directly to my server if it is available:

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

I need to know when a file is available, receiving other information about the file, such as the last change, so that I can compare files and copy new files 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 deny access to this information?

, , .

+3
1

, get_headers ...

mp3

+4

Source: https://habr.com/ru/post/1710311/


All Articles