Head request for last modified date-time failed
===

I use this procedure below to check wether a webcam is last updated. However in somecases it does not show the last update whilie there certainly is last-updated header info. Does any one know why some cases are bypassed? 



    class URIInfo 
    {
        public $info;
        public $header;
        private $url;
    
        public function __construct($url)
        {
            $this->url = $url;
            $this->setData();
        }
    
        public function setData() 
        {
            $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL, $this->url);
            curl_setopt($curl, CURLOPT_FILETIME, true);
            curl_setopt($curl, CURLOPT_NOBODY, true);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    		curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
            $this->header = curl_exec($curl);
            $this->info = curl_getinfo($curl);
            curl_close($curl);
        }
    
        public function getFiletime() 
        {
            return $this->info['filetime'];
        }
    	
    	    public function getFilecode() 
        {
            return $this->info['http_code'];
        }
    
        // Other functions can be added to retrieve other information.
    }
    
    $uri_info = new URIInfo($image);
    $filetime = $uri_info->getFiletime();
    if ($filetime != -1) {
        
    	$lud=date('Y-m-d', $filetime);
    	$today = date("Y-m-d");
    	
    	if ($lud==$today) {
    	echo "today ";
    	echo date('H:i', $filetime);
    	
    	if ($status==1) {
        $sql = "UPDATE sv_cam SET status = 0 WHERE cam_id = $cam_id";
    	$result = mysql_query($sql);
    
    	$sql2 = "UPDATE sv_earlier SET status = 0 WHERE sv_earlier.cam_id = $cam_id";
        $result2 = mysql_query($sql2);
    
     	$sqloff = "DELETE from sv_offline where cam_id=$cam_id";
     	$resoff = mysql_query($sqloff);
    	}
    	
    	} else {
    	
    $datetime1 = date_create($lud);
    $datetime2 = date_create($today);
    $interval = date_diff($datetime1, $datetime2);
    $older= $interval->format('%a');
    
    if ($older==1) {
    echo $older . " day old";
    }
    else {
    echo $older . " days old";
    } 
    
    
    
    if (intval($older)>13) {
    	$sql = "UPDATE sv_cam SET status = 1 WHERE cam_id = $cam_id ";
    	$result = mysql_query($sql);
    
    	$sql2 = "UPDATE sv_earlier SET status = 1 WHERE sv_earlier.cam_id = $cam_id ";
        $result2 = mysql_query($sql2);
    
    	$filecode = $uri_info->getFilecode();
    	
     	$sqloff = "INSERT INTO sv_offline (cam_id,offdate,cde,lud,ip) VALUES ($cam_id,NOW(),'$filecode',NOW(),'$ip')";
     	$resoff = mysql_query($sqloff);
    }
    
    	}
    	
    } else { 
    
    
     }

