PHP : Domain Checker Script
Monday, July 20, 2009 18:44
this script support for malaysian domain name.
example:
- .com.my
- .net.my
- .org.my
- .gov.my
- .edu.my
- .my
<?
$domain = 'gengjawa.com.my'; ##your domain name, you can change this to accept form##
###############
$whois = new whois;
$result = $whois->available($domain);
###############
if ($result){
echo "<tr><td><br/></td></tr>";
echo "<tr><td><font size='6px'>$domain,</td> <td><font color=green><strong>Still Available</strong></font></font></td></tr><br>";
echo "<tr><td><br/><br/></td></tr>";
}
else{
echo "<tr><td><br/></td></tr>";
echo "<tr><td><font size='5px'>$domain,</td> <tr><td><font color=red><strong>this domain has been taken. <br />Please choose another domain</font></font></td></tr><br>";
echo "<tr><td><br/><br/></td></tr>";
}
class whois {
'.com' => array('whois.crsnic.net','No match for'),
'.net' => array('whois.crsnic.net','No match for'),
'.org' => array('whois.publicinterestregistry.net','NOT FOUND'),
'.us' => array('whois.nic.us','Not Found'),
'.biz' => array('whois.biz','Not found'),
'.info' => array('whois.afilias.net','NOT FOUND'),
'.eu' => array('whois.eurid.eu','FREE'),
'.mobi' => array('whois.dotmobiregistry.net', 'NOT FOUND'),
'.tv' => array('whois.nic.tv', 'No match for'),
'.in' => array('whois.inregistry.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'),
'.sg' => array('whois.nic.net.sg','NOMATCH'),
'.com.sg' => array('whois.nic.net.sg','NOMATCH'),
'.per.sg' => array('whois.nic.net.sg','NOMATCH'),
'.org.sg' => array('whois.nic.net.sg','NOMATCH'),
'.com.my' => array('whois.mynic.net.my','does not Exist in database'),
'.net.my' => array('whois.mynic.net.my','does not Exist in database'),
'.org.my' => array('whois.mynic.net.my','does not Exist in database'),
'.gov.my' => array('whois.mynic.net.my','does not Exist in database'),
'.edu.my' => array('whois.mynic.net.my','does not Exist in database'),
'.my' => array('whois.mynic.net.my','does not Exist in database'),
'.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'),
'.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')
);
public $error;
function available($domain){
if (eregi('^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$',$domain) != 1){
$error = 'Invalid domain (Letters, numbers and hypens only) ('.$domain.')';
return false;
}
preg_match('@^(http://www\.|http://|www\.)?([^/]+)@i', $domain, $preg_metch_result);
$f_result = ";
$domain = $preg_metch_result[2];
$domain_name_array = explode('.', $domain);
$domain_domain = strtolower(trim($domain_name_array[count($domain_name_array)-1]));
$ext_in_list = false;
if (array_key_exists('.'.$domain_domain, $this->ext)){
$ext_in_list = true;
}
if(strlen($domain) > 0 && $ext_in_list){
$server = ";
$server = $this->ext['.' .$domain_domain][0];
if ($lookup_result == $server){
$error = 'Error: Invalid extension – '.$domain_domain.'. / server has outgoing connections blocked to '.$server.'.';
return false;
}
$fs = fsockopen($server, 43,$errno,$errstr,10);
if (!$fs || ($errstr != "")){
$error = 'Error: ('.$server.') '.$errstr.' ('.$errno.')';
return false;
}
fputs($fs, "$domain\r\n");
$f_result .= fgets($fs,128);
}
if($domain_domain == 'org'){
}
if(eregi($this->ext['.'.$domain_domain][1], $f_result)){
return true;
} else {
return false;
}
} else {
$error = 'Invalid Domain and/or TLD server entry does not exist';
}
return false;
}
}
?>
You can follow any responses to this entry through the
RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
How I Lost 30 Pounds in 30 Days Without Diet says:
July 24th, 2009 at 8:22 PM
Thanks for posting about this, I would love to read more about this topic.Host2Serve says:
November 4th, 2009 at 2:58 AM
i think should be like this ‘does not exist in database’exist should be lowercase