How to Check Domain Availability in PHP

How to check Domain is available? One is self-hosted PHP script and second is Domain provider website. Today we are sharing PHP Domain Availability Checker Script. Through the PHP script quickly and accurate results you will get it.

As we know, to create a new website, we need to first get the Domain name. And now a day almost all popular or related named domain has already registered. So it’s very difficult to get a selected name. Thus, we have to check the domain name is available or has already registered.

Many Domain registrations and Web hosting service provider companies provide facilities to check Domain availability on their website. But If you want to make your own tool to check the availability of domain name then here we share simply PHP script to make your own Domain checker tool. So let’s see Domain availability checker script in PHP.

Source Code

There are two files first “domain-check.php” the second one is “style.css“.

First, create a file named “domain-check.php” and paste these codes.

<html>
<head><title>Search Availability of Domain...</title>
 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<link rel="stylesheet" href="style.css">
	
</head>
 
<body>
 
<div class="container">
	<div class="row">
        <div class="col-md-6">
    	<h3>Check Domain Name Availability</h3>
		<form action="" method="GET">
            <div id="custom-search-input">
                <div class="input-group col-md-24" >
                    <input type="text" name="domain" class="form-control input-lg" placeholder="Example.com or Example.in etc." />
		<span class="input-group-btn">
                        <button type="submit" class="glyphicon glyphicon-search"></button>
                            
                        
                    </span>
                </div>
            </div>
		</form>
		<?php
 error_reporting(0);
 if(isset($_GET['domain'])){
	 $domain = $_GET['domain'];
	 $godaddycheck = 'https://in.godaddy.com/domains/searchresults.aspx?checkAvail=1&tmskey=&domainToCheck='.$domain.'';
	 $namecomcheck = 'https://www.name.com/domain/search/'.$domain.'';
	 $registercomcheck = 'http://www.register.com/domain/search/wizard.rcmx?searchDomainName='.$domain.'&searchPath=Default&searchTlds=';
 if ( gethostbyname($domain) != $domain ) {
  echo "<h1>Already Registered!</h1>";
 }
 else {
  echo "<h3>$domain</h3><h2><br>Not Taken, you can register it.
  </h2>";
 }
 }
?>
        </div>
	</div>
</div>
 
</body>
 
</html>

After that, Create a CSS file named “style.css” for little bit styling & paste these codes.

.container{
  width: 80%;
  position: absolute;
  top: 30%;
  left: 30%;
  
}
#custom-search-input{
    padding: 3px;
    border: solid 1px #E4E4E4;
    border-radius: 6px;
    background-color: #fff;
	display: inline-block;
}
#custom-search-input input{
    border: 0;
    box-shadow: none;
}
#custom-search-input button{
    margin: 2px 0 0 0;
    background: none;
    box-shadow: none;
    border: 0;
    color: #666666;
    padding: 0 8px 0 10px;
    border-left: solid 1px #ccc;
}
#custom-search-input button:hover{
    border: 0;
    box-shadow: none;
    border-left: solid 1px #ccc;
}
#custom-search-input .glyphicon-search{
    font-size: 23px;
}
h1{
	color:red;
}
h2{
	color:green;
}

Hope you have found this article helpful. Let us know your questions or feedback if any through the comment section in below.

Thank you !

#php #css #html

How to Check Domain Availability in PHP
1 Likes15.65 GEEK