Here is a simple function for checking domain availability using cURL in php.
// Usage:
<?php
domain_check("blogger.com");
?>
<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
function domain_checker($domain) {
$data = 'http://'.$domain;
// Create a curl handle to a non-existing location
$ch = curl_init($data);
// Execute
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
// Check if any error occured
if(curl_errno($ch))
{
return 'The domain is available!';
} else {
return 'The domain is not available';
}
// Close handle
curl_close($ch);
}
?>
// Usage:
<?php
domain_check("blogger.com");
?>






0 comments:
Post a Comment