Im trying to make script which checks if site is up or down. Everything works fine, but when site is NOT a site, I mean that site does not exist. And then php execution load time increase. I want somehow to handle this. How to check if site doesn't exists and break curl session? Here is my script:
<?php
$ch = curl_init('http://86.100.69.228/'); // e.g. for this will increase execution time because the site doesn't exists
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo $status_code;
curl_close($ch);
?>