Retrieve file last modified from file header using CURL Retrieve file last modified from file header using CURL curl curl

Retrieve file last modified from file header using CURL


You can do that with following way by using CURLOPT_HEADER

<?php$curl = curl_init();curl_setopt($curl, CURLOPT_URL, $url);// Only headercurl_setopt($curl, CURLOPT_NOBODY, true);curl_setopt($curl, CURLOPT_HEADER, true);// Do not print anything to outputcurl_setopt($curl, CURLOPT_RETURNTRANSFER, true);// get last modified datecurl_setopt($curl, CURLOPT_FILETIME, true);$result = curl_exec($curl);// Get info$info = curl_getinfo($curl);echo "Last modified time : " . date ("d-m-Y H:i:s", $info['filetime']) );?>