This article will demonstrate you about the Domain Name Checking by using the PHP code. Here our domain name availability checker PHP Script shown below is a very easy to use in your website and install script if your web Server is supporting PHP. The domain name availability checker also checks bulk of domain names in just a single click. Here some of the domains checking is now allowed such as .edu and so on list domains are given below to check their availability.



List of Domains which will be Check for availability

Allowed Domains for checking Availability... .com .net .biz .mobi .tv .in .info .co.uk .co.ug .or.ug .nl .ro .com.au .ca .org.uk .name .us .ac.ug .ne.ug .sc.ug .ws .be .com.cn .net.cn .org.cn .no .se .nu .com.tw .net.tw .org.tw .cc .nl .pl .pt

Example Code for Domain Name Checking in PHP

Just input the desired domain name in the text box and click "check domain availability" button to get the results instantly

<? error_reporting(0); set_time_limit(0); ob_start(); $ext = array( '.com' => array('whois.crsnic.net','No match for'), '.net' => array('whois.crsnic.net','No match for'), '.biz' => array('whois.biz','Not found'), '.mobi' => array('whois.dotmobiregistry.net', 'NOT FOUND'), '.tv' => array('whois.nic.tv', 'No match for'), '.in' => array('whois.inregistry.net', 'NOT FOUND'), '.info' => array('whois.afilias.net','NOT FOUND'), '.co.uk' => array('whois.nic.uk','No match'), '.co.ug' => array('wawa.eahd.or.ug','No entries found'), '.or.ug' => array('wawa.eahd.or.ug','No entries found'), '.nl' => array('whois.domain-registry.nl','not a registered domain'), '.ro' => array('whois.rotld.ro','No entries found for the selected'), '.com.au' => array('whois.ausregistry.net.au','No data Found'), '.ca' => array('whois.cira.ca', 'AVAIL'), '.org.uk' => array('whois.nic.uk','No match'), '.name' => array('whois.nic.name','No match'), '.us' => array('whois.nic.us','Not Found'), '.ac.ug' => array('wawa.eahd.or.ug','No entries found'), '.ne.ug' => array('wawa.eahd.or.ug','No entries found'), '.sc.ug' => array('wawa.eahd.or.ug','No entries found'), '.ws' => array('whois.website.ws','No Match'), '.be' => array('whois.ripe.net','No entries'), '.com.cn' => array('whois.cnnic.cn','no matching record'), '.net.cn' => array('whois.cnnic.cn','no matching record'), '.org.cn' => array('whois.cnnic.cn','no matching record'), '.no' => array('whois.norid.no','no matches'), '.se' => array('whois.nic-se.se','No data found'), '.nu' => array('whois.nic.nu','NO MATCH for'), '.com.tw' => array('whois.twnic.net','No such Domain Name'), '.net.tw' => array('whois.twnic.net','No such Domain Name'), '.org.tw' => array('whois.twnic.net','No such Domain Name'), '.cc' => array('whois.nic.cc','No match'), '.nl' => array('whois.domain-registry.nl','is free'), '.pl' => array('whois.dns.pl','No information about'), '.pt' => array('whois.dns.pt','No match') ); function return_status($domain, $status) { global $extension; $domain = trim($domain); $weight = ($status == 'available') ? 'bold' : 'normal'; $color = ($status == 'available') ? 'green' : 'red'; $decoration = ($status == 'invalid' && $extension == 'org') ? 'underline' : 'none'; if($status == 'invalid' && $extension == 'org') { $status .= ' (Domain <b>.org</b> WHOIS prevents request)'; } echo "<div style= \"font-weight:$weight;color:$color; text-decoration:$decoration\"> $domain is $status!</div>"; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Domain Name Availability Checker</title> </head> <body> <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1"> <tr> <td height="30" align="center"> <h2>Domain Name Availability Checker in PHP</h2> </td> </tr> <tr> <td align="center"><form action="" method="post" name="frmsearchposition" id="frmsearchposition"> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr align="left"> <td width="22%" align="left" valign="middle">Enter Domains <br> One Domain Per Line. <br> Eg: globalguideline.com</td> <td width="52%"> <textarea name="domains" cols="62" rows="8" id="domains"> <?=$_POST['domains']?> </textarea></td> </tr> <tr align="left"> <td width="22%" align="left" valign="middle"> </td> <td width="52%"><input type="submit" name="Submit" value="Check Domain Availability" /> </td> </tr> </table> </form></td> </tr> <tr> <td width="100%" align="center" valign="top"> <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1"> <tr> <td align="center"><h2>Domain Name Availability Report</h2></td> </tr> <tr> <td align="left"> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td align="left"><? if(strlen($_POST['domains']) > 0) { $domains = explode("

", $_POST['domains']); echo '<h2>Checking ' . count($domains) . ' domains</h2>'; echo (isset($_POST['save'])) ? 'Processing results, Please wait...<br /><br />' : null; foreach($domains as $domain) { unset($buffer); preg_match('@^(http://www\.|http://|www\.)?([^/]+)@i', $domain, $matches); $domain = $matches[2]; $tld = explode('.', $domain, 2); $extension = strtolower(trim($tld[1])); if(strlen($domain) > 0 && array_key_exists('.' . $extension, $ext)) { $server = $ext['.' .$extension][0]; $sock = fsockopen($server, 43) or die('Error Connecting To Server:' . $server); fputs($sock, "$domain\r

"); while( !feof($sock) ) { $buffer .= fgets($sock,128); } fclose($sock); if($extension == 'org') echo nl2br($buffer); if(eregi($ext['.' . $extension][1], $buffer)) { return_status($domain, 'available'); } else { return_status($domain, 'taken'); } } else { if(strlen($domain) > 0) { return_status($domain, 'invalid'); } } ob_flush(); flush(); sleep(0.1); } } else { echo 'Please enter one or more domains!'; } ?> </td> </tr> </table></td> </tr> </table> </td> </tr> </table> </body> </html>