HuyPV
Thursday, January 28, 2010
function isLiveURL($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_exec($ch);
if(!curl_errno($ch)) {
$httpcode = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
} else {
$httpcode = -1;
}
curl_close($ch);
return $httpcode == 200 || $httpcode == 301 || $httpcode == 302;
}
Title:
Function isLiveURL
Description:
function isLiveURL($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURL...
...
Rating:
4