Get the last modified date of a remote file

前端 未结 8 2135
难免孤独
难免孤独 2020-11-29 02:45

I would like to get the last modified date of a remote file by means of curl. Does anyone know how to do that?

8条回答
  •  不知归路
    2020-11-29 03:07

    You can activate receiving the headers of the reply with curl_setopt($handle, CURLOPT_HEADER, true). You can also turn on CURLOPT_NOBODY to only receive the headers, and after that explode the result by \r\n and interpret the single headers. The header Last-Modified is the one that you are interested in.

提交回复
热议问题