i went off what you said and i was able to read in the headers and then i did a preg_match and it works with content-length but not with the last-modified
code:
function remoteDateMod($picUrl)
{
//split up that url into a host and such
$picUrl = parse_url($picUrl);
//open the socket to the other server
$pf = fsockopen($picUrl[host],80,$errno,$errstr,30);
//wait for the stuff to become available
socket_set_blocking($pf, TRUE);
//stop if the connection doesnt exist
if (! $pf)
{
return 0;
}
//write the request to the other server
fwrite($pf, "HEAD $picUrl[path] HTTP/1.1\r\nHost: $picUrl[host]\r\n\r\n");
//read in the header
for($result = ""; !feof($pf); $result .= fread($pf, 10000000));
fclose($pf);
if (preg_match("/content-length:\s?(\d+)/i", $result, $date)){
return $date[1];
} else {
return 0;
}
}
echo remoteDateMod("http://alteredstates.gfxsites.net/cams/pixcam.jpg");
?>
thanks