Categories

Find out if a domain name exists

You can user CURL to request a page and evaluate the response to determine if the page exists.

function verify_domain($domain='') {
	$url = "http://" . $domain;
	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_NOBODY, true);
	curl_exec($ch);
	$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	curl_close($ch);
 
	if($code >= 400) {
		return false;
	}
 
	return true;
}

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

IMPORTANT! To be able to proceed, you need to solve the following simple math (so I know that you are a human) :-)

What is 14 + 12 ?
Please leave these two fields as-is: