I use PHP to grab a list of urls from the database. Each url is checked by Check_URL Function in php that uses curl to check if the website is live.
function Check_URL($url) {
$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 3);
$page = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpcode >= 200 && $httpcode <= 301) {
return true;
} else {
return false;
}
}
Unfortunately, the page takes forever to load. I have read curl_multi_init(); might be my solution but I'm not sure how I can implement it into what I have. Thanks in advance.