Opps, I'm too quick with the tab key. Here's the rest of the message:
I've noticed, through a little digging, that there are some people out there that would like to retrieve the modification date of a remote file. I've modified the following function so it returns the header information of a remote file. After the header information is returned parsing out the last modified date is Q.E.D. Would you all mind reviewing it for it's weaknesses?
function remote_header($host,$path){
$fp = fsockopen ($host, 80, $errno, $errstr, 30);
if (!$fp) {
echo "ERROR: $errstr ($errno)<br>\n";
} else {
fputs ($fp, "HEAD $path HTTP/1.0\r\n");
fputs($fp,"HOST: $host\r\n\r\n");
while (!feof($fp)) {
$header=$header.fgets ($fp,4096);
}
fclose ($fp);
}
return $header;
}
The function call would be something like:
remote_header("www.computerjargon.com","/webcam/webcam.jpg");