29
03
Check Domain Name Availability Using PHP Ajax

Hi friends in this tutorial we are going to see how we can check domain name availability using PHP. Whenever we think to own a domain first we need to check whether the particular domain is available or not.It is the free scripts and it helps you to design a system where people or clients can easily check the availability of domain on your server or website. This system allows the user to search the domains with a particular extension or domain with multiple extension. You can also add or remove the extension in the given array.

Check Domain Availability HackandPHP

JQuery:

$(document).ready(function(){
  $('.selectpicker').selectpicker({
    width:'100px'
  });

  $('#btn-search').on('click',function(e){
  	e.preventDefault();
    var search_extension = $('#ddlsearch option:selected').val(),
        search_domain= $('#txtkey').val(),
        $sresult = $('#response'),
    
	if(search_domain && search_extension){
	var formData = {
            'search_domain'              : search_domain,
			'search_extension'			:search_extension
        };
	
	$sresult.html(" Please wait....");
$.ajax({
            type        : 'POST', // define the type of HTTP verb we want to use (POST for our form)
            url         : 'domain_checker.php', // the url where we want to POST
            data        : formData, // our data object
                  
        })
            // using the done promise callback
            .done(function(data) {
                // log data to the console so we can see
				$sresult.html(data);
                // here we will handle errors and validation messages
            });

	e.preventDefault();
	
	}
  });
});

When the user enter the particular domain that they looking for and select the extension that we provided and click the check option the system will send the request to the domain registrars and send back the response to the user by displaying the result. The system will supports all modern browsers and the script are written in an simplest way that any one can easily understand and customize with good programming codes to ease usability.

Domain Checker:

$connection_timeout = 10;
$supported_extensions = array
(
".com" => array("whois_server" => "whois.verisign-grs.com"),
".net" => array("whois_server" => "whois.verisign-grs.com"),
".org" => array("whois_server" => "whois.publicinterestregistry.net"),
".info" => array("whois_server" => "whois.afilias.info"),
".biz" => array("whois_server" => "whois.biz"),
".co.uk" => array("whois_server" => "whois.nic.uk"),
".ca" => array("whois_server" => "whois.cira.ca"),
".com.au" => array("whois_server" => "whois.audns.net.au")
);
$whois_server = $supported_extensions[$extension]['whois_server'];
$port = $whois_servers[$whois_server]['port'];
$query_begin = $whois_servers[$whois_server]['query_begin'];
$query_end = $whois_servers[$whois_server]['query_end'];
$whois_redirect_check = $whois_servers[$whois_server]['redirect'];
$whois_redirect_string = $whois_servers[$whois_server]['redirect_string'];
$no_match_string = $whois_servers[$whois_server]['no_match_string'];
$encoding = $whois_servers[$whois_server]['encoding'];
if($whois_redirect_server)
{

// Query the redirect server.  Might be different values for port etc, so give the option to change them from those set previously.  Using defaults below.

$whois_server = $whois_redirect_server;
$port = "43";
$connection_timeout = 5;
$query_begin = "";
$query_end = "\r\n";

$response = "";

$fp = fsockopen($whois_server,$port,$errno,$errstr,$connection_timeout);

if(!$fp){print "fsockopen() error when trying to connect to {$whois_server}

Error number: ".$errno."
"."Error message: ".$errstr; exit;} fputs($fp,$query_begin.$domain.$extension.$query_end); while(!feof($fp)){$response .= fgets($fp);} fclose($fp); } // Check result for no-match phrase. if(stristr($response,$no_match_string)) { $domain_registered_message .= '
The domain '.$domain.$extension.' is available for registeration
'; } else { $domain_registered_message .= '
The domain '.$domain.$extension.' is already taken
'; } } return $domain_registered_message; }

Note:

This is one of the free scripts. You can use it for your own purpose in single website. For multiple purpose you have to purchase the license. Several features has bee added in the paid version. Above 1000 extension has been added. With the help of back end Mysql you can check from which country user checking the domain on your site. You can look up number of users using your website for checking domain. You can block particular person to avoid searching of domain in your website.

By posted on - 29th Mar 2016

Social Oauth Login

Personalized Map Navigation

Online Image Compression Tool

Image Compression

Advertisement

Recent Posts

Categories