Don't miss
- Tools : The two very best tools for CSSPosted 532 days ago
Ping Whether Website Exist or Not using PHP?
By Shahzaib Khan on January 24, 2012
Looking to test whether a site link exist or not, use the following function:
function urlExists($url=NULL)
{
if($url == NULL) return false;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode>=200) { return true; }
else { return false; }
}

