Return to Snippet

Revision: 27113
at May 23, 2010 04:10 by xida


Initial Code
function url_exists($url) {
	$ch = curl_init($url);
	
	curl_setopt($ch,CURLOPT_HEADER,true);
	curl_setopt($ch,CURLOPT_POST,false);
	curl_setopt($ch,CURLOPT_FAILONERROR,true);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_exec($ch);
    $curlInfo = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	
    curl_close ($ch);

    if ($curlInfo != 200 && $curlInfo != 302 && $curlInfo != 304) {
       return false;
    }else{
        return true ;
    }
}

Initial URL

                                

Initial Description

                                

Initial Title
check if url exists

Initial Tags

                                

Initial Language
PHP