$fp = fsockopen($host, $port, $errno, $errstr, 30);
$http_code = 0;
$new_loc = "";
if ($fp) {
$out = "HEAD $page HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
do {
$header = fgets ($fp, 4096);
} while ($header && (strstr($header, "Last-Modified:") === false));
if ($header) {
$theader = split(" ", $header);
$lastmodified = $theader[1];
}
fclose($fp);
}
$lastmodified will the last modified header content, if it was present. Else, it will be unset.