<?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'];
?>