Instead of the file itself?
EDIT
Best with a demo in PHP?
Instead of the file itself?
EDIT
Best with a demo in PHP?
You need to write some service to handle the http request and extract the last modified date for the requested file and return the date in response.
In your HTTP request you should add any of these header attributes, and you may receive an 304 (Last modified)
Andrei is correct, HEAD will only get the headers. My suggestion will return only the header and no body if the condictions are met. If the content has been updated the body will contain the new information.
Yes. The "HEAD" method returns only the response headers and not the actual data.
<?php
// Get Headers
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
// Process Headers
$headerLines = explode("\r\n", $response);
foreach ($headerLines as $headerLine) {
$headerLineParts = explode(': ', $headerLine);
if (count($headerLineParts) >= 2) {
$headers[$headerLineParts[0]] = $headerLineParts[1];
}
}
echo $headers['Last-Modified'];
?>