I have a problem working with
curl_getinfo
I have already checked the php.ini for curl extension and everything seems to be fine and inside phpinfo();, curl is enable so I know that It shouldn’t have any problem.
This function runs fine in my web server. It is my local machine with XAMPP 1.7.7 that gives me a hard time. Could this be because of firwall settings of my laptop?
Please note that the jpg file exists inside the Amazon s3 URL and I have checked the Amazon URL on the browser and it shows the image…
/////////////////// Edited //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
here is my code which is a function or method inside a class:
public function pictureExistence($id){
$url = AMAZON_S3_URL . $id . '.jpg';
//var_dump($url);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
//var_dump($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
//var_dump($code);
if($code == 200){
$status = true;
}else{
$status = false;
}
curl_close($ch);
return $status;
}
Try the following code and check whether it’s working for you. It has been tested to work fine on XAMPP 1.7.7 .