PHP - Download file and preserve timestamp? -


as name suggests, there quick way download file, bring timestamp along?

i'm writing basic cache that, among other checks, determines (via get_headers) if given local file same it's remote counterpart.

i know can file_get_contents / file_put_contents , touch() file results of get_headers, calling making http call (even if head call) , i'd test last-modified last resort.

so there quick, "one http call" way download file , preserve timestamp? remote files live on ftp server, many text files, , / or live on web server.

edit: suggested related question, question differs, in i'm looking remote modified date without having make second call, copy() based answer suggests

$http_response_header seems trick, suggested below.

you can cached last-modified $http_response_header , use touch file.

to automate not possible stream cannot know going store it.


Comments