IT.COM

PHP: Bulk domain availability check!

NameSilo
Watch
PHP: Bulk domain availability check! [UPDATED]

This is something i was going to start however i don't really have time, so i have whipped up a quick script for you guys to use on your own site or just for personal use.

The script has been tested quickly tonight as i want to go to bed lol. I hope it is of some use.

Demo: Now offline sorry.


UPDATED CODE (Revision 6): (18/02/07)


Download everything here!

.ORG support removed due to a block from the WHOIS server (PIR)

- .pt support fixed!

- Added "save results as text file" feature - requested.

- Code shortened

- Added .in support
- Bug fixes

- Added .tv domain support - requested

- Other bug fixes (again ;))

- Will now output result before checking next domain (much faster)
- Added .mobi support - requested

- Other bug fixes

PHP:
<?php
set_time_limit(0);
ob_start();
/* 	--------	Bulk domain availablity check script (Revision 4) ------------		
[																					
[ 	Created by "Matthew." (#45276) @ http://namepros.com / http://toomanylines.com		
[	Feel free to modify/use however you wish,										
[	but keep credit comments in upon distribution.								
*/

include 'inc/dnservers.php';

function save_file($status) 
{
	global $filename, $domain, $extension;
	
	$domain = trim($domain);
	
	$file_handle = fopen($filename . "_$status.txt", 'a+') or trigger_error('Cannot open or create file (chmod?)', E_USER_WARNING);
	
	if($status == 'invalid' && $extension == 'org') { $status .= ' (.org WHOIS prevents request)'; }
				
	if(!fwrite($file_handle, $domain . " is $status\n"))
	{
		trigger_error('Results for ' . $domain . ' could not be written.', E_USER_WARNING);
	}
	
	fclose($file_handle);	
}

function return_status($domain, $status)
{	
	global $extension, $filename;

	
	$file = $filename;
	$domain = trim($domain);
	
	if(isset($_POST['save']))
	{
			save_file( $status );
	}
	else
	{	
		$color = ($status == 'available') ? 'green' : 'red';
		if($status == 'invalid' && $extension == 'org') { $status .= ' (.org WHOIS prevents request)'; }	
			
		echo "<div style=\"color: $color\">$domain is $status!</div>";
	}
}	
	
if(isset($_POST['submit']))
{
	$filename = 'saves/' . mt_rand(5, 9999999999);
		
	if(strlen($_POST['domains']) > 0)
	{

		$domains = explode("\n", $_POST['domains']);
		
		echo '<h1>Checking ' . count($domains) . ' domains</h1><br />';
		echo (isset($_POST['save'])) ? 'Preparing results, please wait...<br /><br />' : null;
		
		foreach($domains as $domain)
		{
			unset($buffer); // clean buffer - prevents problems
					
			// (replaced str_replace)	
			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\n");
				
				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(); // output before checking next domain
			flush();
			sleep(0.1);
		}
		
		if(isset($_POST['save']) && count($domains) > 0)
		{
			echo 'Check completed, your results can be found below:';
		
			if(file_exists($filename . '_available.txt'))
			{
				echo '<br /><a href="' . $filename . '_available.txt">Available domains</a>';
			}
			
			if(file_exists($filename . '_taken.txt'))
			{
				echo '<br /><a href="' . $filename . '_taken.txt">Taken domains</a>';
			}
			else
			{
				echo '<br />0 taken domains found';
			}
			
			if(file_exists($filename . '_invalid.txt'))
			{
				echo '<br /><a href="' . $filename . '_invalid.txt">Invalid domains (could not be checked)</a>';
			}
		}	
	}
	else
	{
		echo 'You need to enter one or more domains!';
	}
} 
else
{
	?>
<div style="text-align: center">
	<form action="index.php" method="post">
		<textarea name="domains" cols="100" rows="20"></textarea>
		<br /><input type="checkbox" name="save" value="save" /> Save results as text file?<br />
		<br /><input type="submit" name="submit" value="Check Availability" style="font-size: 30pt;" />
		
	</form>
</div>
	<?php
}
?>


Instructions:

Unzip, Upload, CHMOD "saves" to 777, use!



Supported extensions are:

.com
.net
.biz
.info
.co.uk
.co.ug
.or.ug
.nl
.tv
.mobi
.in

.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
.pl
.pt

It is not coded well but this was started very early in the morning so i have an excuse lol. It works so hey ;)

Enjoy.
 
Last edited:
17
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
mtorregiani said:
Thanks
It rock!!!

Rep Added
PS: Can I use it on my blog? You'll get a free link... PM me if interested

Thanks mtorregiani, You may use it wherever you want! No link required :)
 
2
•••
~ Cyberian ~ said:
Matthew, OUTSTANDING share!!!! Rep up'd

EDIT: Sorry I'm at my limit giving rep for today, but I'll catch up tomorrow.

Thanks ~ Cyberian ~, truly appreciated :) (im not fussed about the rep, whenever :D)
 
2
•••
champ_rock said:
is there any way so that the result will be added to a text file automatically?

Sure thing, i am now going out for the day however if you will wait until about 7/8 GMT then i will get it up for you :)
 
2
•••
Hi all,

Will this help any way to make this domain availability checker more efficient one?
B-)

.br.co: W- CentralNic Brazil <!-- whois.centralnic.net * -->
.cn.co: W- CentralNic China <!-- whois.centralnic.net * -->
.de.co: W- CentralNic Germany <!-- whois.centralnic.net * -->
.eu.co: W- CentralNic European Union <!-- whois.centralnic.net * -->
.gb.co: W- CentralNic Great Britain <!-- whois.centralnic.net * -->
.gb.ne: W- CentralNic Great Britain <!-- whois.centralnic.net * -->
.hu.co: W- CentralNic Hungary <!-- whois.centralnic.net * -->
.jpn.c: W- CentralNic Japan <!-- whois.centralnic.net * -->
.no.co: W- CentralNic Norway <!-- whois.centralnic.net * -->
.qc.co: W- CentralNic Quebec <!-- whois.centralnic.net * -->
.ru.co: W- CentralNic Russian Federation <!-- whois.centralnic.net * -->
.sa.co: W- CentralNic Saudi Arabia <!-- whois.centralnic.net * -->
.se.co: W- CentralNic Sweden <!-- whois.centralnic.net * -->
.se.ne: W- CentralNic Sweden <!-- whois.centralnic.net * -->
.uk.co: W- CentralNic United Kingdom <!-- whois.centralnic.net * -->
.uk.ne: W- CentralNic United Kingdom <!-- whois.centralnic.net * -->
.us.co: W- CentralNic United States <!-- whois.centralnic.net * -->
.uy.co: W- CentralNic Uruguay <!-- whois.centralnic.net * -->
.web.c: W- CentralNic The Web <!-- whois.centralnic.net * -->
.za.co: W- CentralNic South Africa <!-- whois.centralnic.net * -->
.ac : W- Ascension Island <!-- whois.nic.ac * -->
.ac.uk: W- [United Kingdom-AC] <!-- whois.ja.net * -->
.ad : -- Andorra <!-- * *Has no WHOIS or web-based WHOIS (see http://www.nic.ad) -->
.ae : W- United Arab Emirates <!-- whois.nic.ae *Has no WHOIS or web-based WHOIS (only 'yes/no' at www.uaenic.ae). -->
.aero : W- [Generic: air transport] <!-- whois.aero * -->
.af : -w Afghanistan <!-- * http://www.nic.af/whois.jsp -->
.ag : W- Antigua and Barbuda <!-- whois.nic.ag * -->
.ai : Ww Anguilla <!-- whois.ainic.ai http://whois.offshore.ai/cgi-bin/whois.pl?domain-name=~DOMAIN~ -->
.al : -w Albania <!-- * http://www.inima.al/Domains.html -->
.am : Ww Armenia <!-- whois.amnic.net https://www.amnic.net/whois/?domain=~DOMAIN~ -->
.an : -- Netherlands Antilles <!-- * *Has no WHOIS or web-based WHOIS (www.una.an). -->
.ao : -- Angola <!-- * *IANA has no contact info. -->
.aq : -- Antarctica <!-- * *IANA has no contact info for .aq. -->
.ar : -w Argentina <!-- * http://www.nic.ar/consultas/consdom.html?nombre=~DOMAIN~ -->
.arpa : W- [Address and Routing Parameter Area] <!-- whois.iana.org * -->
.as : W- American Samoa <!-- whois.nic.as * -->
.at : W- Austria <!-- whois.nic.at * -->
.au : W- Australia <!-- whois.ausregistry.net.au * -->
.aw : -- Aruba <!-- * *IANA has no contact info. -->
.ax : -- Aland Islands <!-- * *IANA has no contact info. -->
.az : -- Azerbaijan <!-- * *IANA has no contact info; www.az has no WHOIS. -->
.ba : -w Bosnia-Herzegovina <!-- * http://www.nic.ba/stream/whois/ -->
.bb : -w Barbados <!-- * http://domains.org.bb/regsearch/getdetails.cfm?DND=~DOMAIN~ -->
.bd : -w Bangladesh <!-- * http://www.bttb.net.bd:8080/dotbd/ViewDomain_2.jsp?dName=~DOMAINSUB~&Submit=submit -->
.be : W- Belgium <!-- whois.dns.be * -->
.bf : -- Burkina Faso (Upper Volta) <!-- * *IANA contact information doesn't respond. -->
.bg : W- Bulgaria <!-- whois.register.bg * -->
.bh : -- Bahrain <!-- * *Has no WHOIS or web-based WHOIS (www.inet.com.bh). -->
.bi : W- Burundi <!-- whois.nic.bi *Has no WHOIS or web-based WHOIS (only 'yes/no' at www.nic.bi/whois.asp). -->
.biz : W- [Generic: business] <!-- whois.biz * -->
.bj : W- Benin <!-- whois.nic.bj *IANA has no contact information. -->
.bm : -w Bermuda <!-- * http://207.228.133.14/cgi-bin/lansaweb?procfun+BMWHO+BMWHO2+WHO -->
.bn : -- Brunei Darussalam <!-- * *Has no WHOIS or web-based WHOIS. -->
.bo : -w Bolivia <!-- * http://www.nic.bo/ -->
.br : W- Brazil <!-- whois.nic.br * -->
.bs : -w Bahamas <!-- * http://dns.nic.bs/cgi-bin/search.pl -->
.bt : W- Bhutan <!-- whois.nic.as * -->
.bv : W- Bouvet Island <!-- whois.norid.no *Has no WHOIS or web-based WHOIS (www.norid.no) -->
.bw : -- Botswana <!-- * *IANA has no contact information. -->
.by : -- Belarus <!-- * *Has no WHOIS or web-based WHOIS (only 'yes/no' at www.tld.by/cgi-bin/checkdomain.cgi) -->
.bz : W- Belize <!-- whois.belizenic.bz * -->
.ca : W- Canada <!-- whois.cira.ca * -->
.cat : Ww [Generic: Catalan linguistic and cultural community] <!-- whois.cat http://domini.cat/whois.html -->
.cc : W- Cocos (Keeling) Island <!-- whois.nic.cc * -->
.cd : W- Zaire <!-- whois.nic.cd * -->
.cf : -- Central African Republic <!-- * *IANA has no contact information. -->
.cg : -w Congo <!-- * http://www.nic.cg/cgi-bin/whoiscg.pl -->
.ch : W- Switzerland <!-- whois.nic.ch * -->
.ci : Ww Ivory Coast <!-- whois.nic.ci http://www.nic.ci/ -->
.ck : W- Cook Islands <!-- whois.ck-nic.org.ck * -->
.cl : W- Chile <!-- whois.nic.cl * -->
.cm : -- Cameroon <!-- * *IANA contact info.intelcam.cm doesn't respond. -->
.cn : W- China <!-- whois.cnnic.net.cn * -->
.co : -w Columbia <!-- * http://www.nic.co -->
.co.uk: W- [United Kingdom-CO] <!-- whois.nic.uk * -->
.com : W- [Generic: commercial] <!-- rs.internic.net * -->
.coop : W- [Generic: coops] <!-- whois.nic.coop * -->
.cr : -w Costa Rica <!-- * http://www.nic.cr/consulta-dns.html -->
.cs : -- Serbia and Montenegro <!-- * *IANA has no contact information -->
.cu : -w Cuba <!-- * http://www.nic.cu/consultas/infdomain.asp?Dominio=~DOMAIN~ -->
.cv : -- Cape Verde <!-- * *IANA has no contact information (www.dns.cv doesn't have WHOIS) -->
.cx : W- Christmas Island <!-- whois.nic.cx * -->
.cy : -w Cyprus <!-- * http://www.nic.cy/nslookup/online_database.php -->
.cz : W- Czech Republic <!-- whois.nic.cz * -->
.de : W- Germany <!-- whois.denic.de * -->
.dj : -- Djibouti <!-- * *Has no WHOIS or web-based WHOIS (www.intnet.dj) -->
.dk : W- Denmark <!-- whois.dk-hostmaster.dk * -->
.dm : -- Dominica <!-- * *IANA has no contact information. -->
.do : -w Dominican Republic <!-- * http://www.nic.do/whois-hin.php3 -->
.dz : -w Algeria <!-- * http://www.nic.dz/anglais/pdom-att-eng.htm -->
.ec : -w Ecuador <!-- * http://www.nic.ec/eng/consulta/whois.asp?dominio=~DOMAIN~ -->
.edu : W- [educational] <!-- whois.educause.net * -->
.edu.c: W- [China: Educational] <!-- whois.edu.cn * -->
.ee : W- Estonia <!-- whois.eenet.ee * -->
.eg : -- Egypt <!-- * *IANA has no contact information for .eg; www.frcu.eun.eg has no WHOIS or web-based WHOIS. -->
.eh : -- Western Sahara <!-- * *IANA has no contact information for .eh -->
.er : -- Eritrea <!-- * *IANA has no contact information for .er. -->
.es : -w Spain <!-- * https://www.nic.es/esnic/servlet/BuscarDomSolAlta?dominio=~DOMAIN~&surfijo=es&tipo=dominio -->
.et : -- Etheopia <!-- * *Has no WHOIS or web-based WHOIS (www.telecom.net.et). -->
.eu : W- European Union <!-- whois.eu * -->
.examp: -- [For Examples] <!-- * *.example is used in documentation and examples per RFC2606. -->
.fi : Ww Finland <!-- whois.ficora.fi http://cgi.ficora.fi/wwwbin/domains.pl?language=eng&search=~DOMAIN~&liststart=a&listend=a -->
.fj : W- Fiji <!-- whois.usp.ac.fj * -->
.fk : W- Falkland Islands (Malvinas) <!-- whois.nic.fk *Has no WHOIS or web-based WHOIS (www.fidc.org.fk). -->
.fm : -w Micronesia <!-- * http://www.dot.fm/query_whois.cfm?domain=~DOMAINSUB~&tld=~DOMAINTLD~ -->
.fo : -w Faroe Islands <!-- * http://www.nic.fo/custom2/lookup/domain.asp?domainname=~DOMAIN~ -->
.fr : W- France <!-- whois.nic.fr * -->
.ga : -- Gabonese Republic <!-- * *IANA has no contact information for .ga. -->
.gb : -- Great Britain <!-- * *IANA has no contact information for .gb. -->
.gd : -- Grenada <!-- * *IANA has no contact information for .gd. -->
.ge : -- Republic of Georgia <!-- * *Has no WHOIS or web-based WHOIS (web-based WHOIS broken 09 Sep 2002; www.nic.net.ge/index_en.html). -->
.gf : -- French Guiana <!-- * *Has no WHOIS or web-based WHOIS (web-based WHOIS broken 09 Sep 2002; http://www.nplus.gf/GF/). -->
.gg : W- Guernsey <!-- whois.isles.net * -->
.gh : -- Ghana <!-- * *Has no WHOIS or web-based WHOIS (http://www.ghana.com.gh/domain.htm) -->
.gi : -w Gibraltar <!-- * http://whois.gibnet.gi?lookup=~DOMAIN~ -->
.gov : W- [U.S. Government] <!-- whois.nic.gov * -->
.gov.u: W- [United Kingdom Government] <!-- whois.ja.net * -->
.gl : -- Greenland <!-- * *Has no WHOIS or web-based WHOIS. -->
.gm : Ww Gambia <!-- whois.ripe.net http://www.commit.gm/scripts/checkdom.asp?dname=~DOMAIN~ -->
.gn : -- Guinea <!-- * *Has no WHOIS or web-based WHOIS (http://psg.com/dns/gn/). -->
.gp : -- Guadeloupe <!-- * *Has no WHOIS or web-based WHOIS. -->
.gq : -- Equatorial Guinea <!-- * *Has no WHOIS or web-based WHOIS (www.getesa.gq) -->
.gr : Ww Greece <!-- whois.grnet.gr https://grweb.ics.forth.gr/Whois?lang=en -->
.gs : W- South Georgia <!-- whois.adamsnames.tc * -->
.gt : -w Guatemala <!-- * http://www.gt/cgi-bin/whois.cgi?domain=~DOMAIN~ -->
.gu : -- Guam <!-- * *Has no WHOIS or web-based WHOIS (gadao.gov.gu) -->
.gw : -- Guinea-Bissau <!-- * *IANA has no contact information for .gw. -->
.gy : -- Guyana <!-- * *IANA has no contact information for .gy. -->
.hk : W- Hong Kong <!-- whois.hkdnr.net.hk * -->
.hm : W- Heard and McDonald Islands <!-- whois.registry.hm * -->
.hn : W- Honduras <!-- whois2.afilias-grs.net *Has no WHOIS or web-based WHOIS. -->
.hr : -- Croatia <!-- * *Has no WHOIS or web-based WHOIS. -->
.ht : -- Haita <!-- * *IANA contact www.haitiworld.com doesn't respond (09 Sep 2002). -->
.hu : W- Hungary <!-- whois.nic.hu * -->
.id : W- Indonesia <!-- whois.idnic.net.id * -->
.ie : W- Ireland <!-- whois.domainregistry.ie * -->
.gov.i: W- Israel <!-- whois.ripe.net * -->
.il : W- Israel <!-- whois.isoc.org.il * -->
.im : -- Isle of Man <!-- * *Has no WHOIS or web-based WHOIS (only 'yes/no' at www.nic.im/exist.html) -->
.in : Ww India <!-- whois.inregistry.net http://domain.ncst.ernet.in/search.php -->
.io : Ww British Indian Ocean Territory <!-- whois.nic.io http://www.io.io/whois.html -->
.info : W- [Generic: information] <!-- whois.afilias.info * -->
.int : W- [Generic: International Treaties] <!-- whois.iana.org * -->
.inval: -- [For Testing] <!-- * *.invalid is used for online construction of invalid domain names per RFC2606. -->
.iq : -- Iraq <!-- * *IANA has no contact information for .iq. -->
.ir : Ww Iran <!-- whois.nic.ir -->
.is : W- Iceland <!-- whois.isnet.is * -->
.it : W- Italy <!-- whois.nic.it * -->
.je : W- Jersey <!-- whois.isles.net * -->
.jm : -- Jamaica <!-- * *Has no WHOIS or web-based WHOIS (www.com.jm) -->
.jo : -w Jordan <!-- * http://www.nis.gov.jo/dns/owa/jo_domains_search?domain_criterion=~DOMAIN~ -->
.jobs : -- [Generic: for human resource managers] <!-- * * -->
.jp : W- Japan <!-- whois.nic.ad.jp * -->
.ke : Ww Kenya <!-- whois.kenic.or.ke http://www.kenic.or.ke/cgi-bin/kenic/whois?qr=~DOMAIN~ -->
.kg : -w Kyrgyzstan <!-- * http://www.domain.kg/whois.html -->
.kh : -- Cambodia <!-- * *Has no WHOIS or web-based WHOIS (www.camnet.com.kh or www.khnic.net.kh) -->
.ki : -- Kiribati <!-- * *IANA has no contact information for .ki. -->
.km : -- Comoros <!-- * *IANA has no contact information for .km. -->
.kn : -- Saint Kitts and Nevis <!-- * *IANA has no contact information for .kn. -->
.kp : -- Korea, Democratic People's Republic <!-- * *IANA has no contact information for .kp -->
.kr : W- Korea <!-- whois.nic.or.kr * -->
.kw : -- Kuwait <!-- * *IANA has no contact information for .kw; www.domainname.net.kw doesn't respond (06 Sep 2002). -->
.ky : -w Cayman Islands <!-- * http://146.115.157.215/whoisfrontend.asp -->
.kz : Ww Kazakhstan <!-- whois.nic.kz http://www.nic.kz/cgi-bin/whois?query=~DOMAIN~ -->
.la : W- Laos <!-- whois.nic.la * -->
.lb : -w Lebanon <!-- * http://www.aub.edu.lb/lbdr/search.html -->
.lc : -- Saint Lucia <!-- * *Has no WHOIS or web-based WHOIS (www.isisworld.lc/domains) -->
.li : W- Liechtenstein <!-- whois.nic.li * -->
.lk : W- Sri Lanka <!-- whois.nic.lk * -->
.local: -- [For local use] <!-- * *.localhost is used to refer to the local host per RFC2606. -->
.lr : -- Liberia <!-- * *Has no WHOIS or web-based WHOIS (http://www.psg.com/dns/lr/) -->
.ls : -- Lesotho <!-- * *Has no WHOIS or web-based WHOIS (co.ls) -->
.lt : W- Lithuania <!-- whois.domreg.lt * -->
.lu : W- Luxembourg <!-- whois.dns.lu * -->
.lv : W- Latvia <!-- whois.nic.lv *www.nic.lv has no WHOIS or web-based WHOIS. -->
.lu : W- Luxembourg <!-- whois.dns.lu * -->
.ly : Ww Libya <!-- whois.lydomains.com http://www.lydomains.ly/ListWhoIs.php?domain_name=~DOMAIN~ -->
.ma : -- Morocco <!-- * *IANA contact is bogus. -->
.mc : W- Monaco <!-- whois.ripe.net *IANA has no contact information for .mg. -->
.md : -w Moldova <!-- * http://www.register.md/whois.jsp?domainName=~DOMAINSUB~ -->
.mg : -- Madagascar <!-- * *IANA has no contact information for .mg. -->
.mh : -- Marshall Islands <!-- * *Has no WHOIS or web-based WHOIS (www.nic.net.mh). -->
.mil : W- [U.S. Military] <!-- whois.nic.mil * -->
.mk : -- Macedonia <!-- * *Has no WHOIS or web-based WHOIS (www.mt.net.mk). -->
.ml : -- Mali <!-- * *Has no WHOIS or web-based WHOIS (www.sotelma.ml). -->
.mm : -- Myanmar (Burma) <!-- * *IANA contact does not respond (www.nic.mm) (11 Sep 2002). -->
.mn : -w Mongolia <!-- * http://www.nic.mn/index.php3?command=owner&domainname=~DOMAINSUB~ -->
.mo : -- Macau <!-- * *www.monic.net.mo has no WHOIS or web-based WHOIS (06 Sep 2002). -->
.mobi : -- [Generic: for consumers and providers of mobile products] <!-- * * -->
.mp : -- Northern Mariana Islands <!-- * *Has no WHOIS or web-based WHOIS (www.nic.mp). -->
.mq : -- Martinique <!-- * *IANA contact does not respond (www.nic.mq) (11 Sep 2002). -->
.mr : -- Mauritania <!-- * *Has no WHOIS or web-based WHOIS (www.univ-nkc.mr/nic_mr.html). -->
.ms : W- Montserrat <!-- whois.adamsnames.tc * -->
.mt : -w Malta <!-- * http://www.um.edu.mt/cgi-bin/nic/whois?domain=~DOMAIN~ -->
.mu : W- Mauritius <!-- whois.nic.mu * -->
.mv : -- Maldives <!-- * *IANA has no contact information for .mv. -->
.mw : -- Malawi <!-- * *IANA has bogus contact information for .mv (www.tarsus.net). -->
.museu: W- [Generic: Museums] <!-- whois.museum * -->
.mx : W- Mexico <!-- whois.nic.mx * -->
.my : Ww Malaysia <!-- whois.mynic.net.my http://www.mynic.net.my/newhp/mynic-lookup.htm -->
.mz : -- Mozambique <!-- * *IANA has no contact information for .mz. -->
.name : W- [Generic: Personal Names] <!-- whois.nic.name * -->
.na : Ww Namibia <!-- whois.na-nic.com.na http://www.lisse.na/cgi-bin/whois.cgi?domain=~DOMAINSUB~ -->
.nc : W- New Caledonia <!-- whois.cctld.nc * -->
.ne : -- Niger <!-- * *www.intnet.ne has no WHOIS or web-based WHOIS. -->
.net : W- [networks] <!-- rs.internic.net * -->
.nf : -- Norfolk Island <!-- * *Has no WHOIS or web-based WHOIS (www.names.nf). -->
.ng : -- Nigeria <!-- * *Has no WHOIS or web-based WHOIS (psg.com/dns/ng/). -->
.ni : -- Nicaragua <!-- * *IANA contact information bogus; www.nic.ni requires special software to access. -->
.nl : Ww Netherlands <!-- whois.sidn.nl http://www.nic.nl -->
.no : W- Norway <!-- whois.norid.no * -->
.np : -- Nepal <!-- * *www.mos.com.np has no WHOIS or web-based WHOIS (only 'yes/no'). -->
.nr : -w Nauru <!-- * http://www.cenpac.net.nr/dns/index.html -->
.nu : W- Niue <!-- whois.nic.nu * -->
.nz : W- New Zealand <!-- whois.srs.net.nz * -->
.org : W- [organizations] <!-- whois.publicinterestregistry.net * -->
.om : -w Oman <!-- * http://www.omnic.om/onlineUser/whoisMain.jsp?sourcePage=WHOISLookup&sourcePage=registerDomain&domain -->
.pa : -w Panama <!-- * http://whois.pa/cgi-bin/newrwhoiss.cgi?domain=~DOMAIN~ -->
.pe : -- Peru <!-- * *www.nic.pe has no WHOIS or web-based WHOIS. -->
.pf : -- French Polynesia <!-- * *IANA has no contact information for .pf. -->
.pg : -- Papua New Guinea <!-- * *IANA has no contact information for .pg. -->
.ph : -w Philippines <!-- * http://www.domains.ph/WhoIs.asp?Domain=~DOMAIN~ -->
.pk : -w Pakistan <!-- * http://pknic.net.pk:443/cgi-bin/pknic-db/display.html?name=~DOMAIN~ -->
.pl : W- Poland <!-- whois.dns.pl * -->
.pm : W- Saint Pierre and Miquelon <!-- whois.nic.pm *IANA contact does not handle .pm domain (www.nic.pm)! -->
.pn : -- Pitcairn <!-- * *Has no WHOIS or web-based WHOIS (www.nic.pn). -->
.pr : Ww Puerto Rico <!-- whois.uprr.pr http://www.uprr.pr/domain/whois.asp -->
.pro : W- [Generic: Professionals] <!-- whois.registrypro.pro *IANA contact http://www.registrypro.com has no WHOIS -->
.ps : -w Palestine <!-- * http://www.nic.ps/whois/domain_whois.php?dname=~DOMAIN~ -->
.pt : W- Portugal <!-- whois.dns.pt * -->
.pw : W- Palau <!-- whois.nic.pw * -->
.py : -w Paraguay <!-- * http://www.nic.py/consultas.html -->
.qa : -- Qatar <!-- * *www.qatar.net.qa has no WHOIS or web-based WHOIS. -->
.re : W- Réunion <!-- whois.afnic.re * -->
.ro : W- Romania <!-- whois.rotld.ro * -->
.ru : W- Russia <!-- whois.ripn.ru * -->
.rw : -w Rwanda <!-- * http://www.nic.rw/cgi-bin/whoisrw.pl -->
.sa : Ww Saudi Arabia <!-- whois.nic.net.sa http://www.nic.net.sa/page.php?page=18&lang=1 -->
.sb : W- Solomon Islands <!-- whois.nic.net.sb *Has no WHOIS or web-based WHOIS (www.nic.net.sb). -->
.sc : W- Seychelles <!-- whois2.afilias-grs.net *Has no WHOIS or web-based WHOIS (www.nic.sc). -->
.sd : -- Sudan <!-- * *IANA contact does not respond (www.sudatel.sd). -->
.se : W- Sweden <!-- whois.nic-se.se * -->
.sg : W- Singapore <!-- whois.nic.net.sg * -->
.sh : W- St. Helena <!-- whois.nic.sh * -->
.si : W- Slovenia <!-- whois.arnes.si * -->
.sj : W- Svalbard and Jan Mayen Islands <!-- whois.norid.no *Has no WHOIS or web-based WHOIS (www.norid.no) -->
.sk : W- Slovak Republic <!-- whois.ripe.net * -->
.sl : -- Sierra Leone <!-- * *IANA has no contact information for .sl. -->
.sm : W- San Marino <!-- whois.ripe.net * -->
.sn : -- Senegal <!-- * *Has no WHOIS or web-based WHOIS (www.nic.sn). -->
.so : -- Somali <!-- * *Has no WHOIS or web-based WHOIS (www.nic.so). -->
.sr : -w Suriname <!-- * http://www.register.sr/?p=whois&step=search&type=domain&domain=~DOMAINSUB~ -->
.st : W- St. Tome and Prince. <!-- whois.nic.st * -->
.su : -- Soviet Union <!-- * *IANA has no contact information for .su. -->
.sv : -- El Salvador <!-- * *www.nic.sv has no WHOIS or web-based WHOIS. -->
.sy : -- Syria <!-- * *IANA has no contact information for .sy. -->
.sz : -- Swaziland <!-- * *http://www.iafrica.sz/domreg has no WHOIS or web-based WHOIS. -->
.tc : W- Turks and Caicos Islands <!-- whois.adamsnames.tc * -->
.td : -w Chad <!-- * http://www.nic.td/index.php?domain=~DOMAINSUB~&SEARCH.x=55&SEARCH.y=23 -->
.test : -- [For Testing] <!-- * *.test is used for testing DNS per RFC2606. -->
.tf : W- French Southern Terr. <!-- whois.adamsnames.tc * -->
.tg : -- Togolese Republic <!-- * *IANA contact does not respond (www.nic.tg). -->
.th : W- Thailand <!-- whois.thnic.net * -->
.tj : W- Tadjikistan <!-- whois.nic.tj * -->
.tk : Ww Tokelau <!-- whois.dot.tk http://my.dot.tk/cgi-bin/whois.taloha?flddomainname=~DOMAINSUB~ -->
.tl : -w Timor-Leste <!-- * http://www.nic.tl/whois.jsp -->
.tm : W- Turkmenistan <!-- whois.nic.tm * -->
.tn : -- Tunesia <!-- * *http://www.ati.tn/Nic has no WHOIS or web-based WHOIS. -->
.to : W- Tonga <!-- whois.tonic.to * -->
.tp : -- East Timor <!-- * *Has no WHOIS or web-based WHOIS (www.nic.tp). -->
.tr : W- Turkey <!-- whois.metu.edu.tr * -->
.trave: Ww [Generic: Travel] <!-- whois.nic.travel http://www.whois.travel/whois.cgi?TLD=travel&dn=~DOMAIN~&TYPE=DOMAIN&Search=Submit+Query -->
.tt : -w Trinidad and Tobago <!-- * http://www.nic.tt/cgi-bin/search.pl?name=~DOMAIN~ -->
.tv : Ww Tuvalu <!-- whois.nic.tv http://www.tv/en-def-c31b679d23bf/cgi-bin/lookup.cgi?email=whoissearch&domain=~DOMAIN~ -->
.tw : W- Taiwan <!-- whois.twnic.net.tw * -->
.tz : -- Tanzania <!-- * *Has no WHOIS or web-based WHOIS (www.psg.com/dns/tz). -->
.ua : W- Ukraine <!-- whois.net.ua * -->
.ug : Ww Uganda <!-- whois.co.ug http://www.registry.co.ug/whois/whois_show.php?domain=~DOMAIN~ -->
.uk : W- United Kingdom <!-- whois.nic.uk * -->
.um : -- United States Minor Outlying Islands <!-- * *IANA contact does not respond (www.nic.um). -->
.us : Ww United States <!-- whois.nic.us http://www.whois.us/whois.cgi?TLD=us&dn=~DOMAIN~&TYPE=DOMAIN&Search=Submit+Query -->
.uy : Ww Uruguay <!-- sepe.rau.edu.uy http://www.rau.edu.uy/cgi/dom.pl?dominio=~DOMAIN~ -->
.uz : Ww Uzbekistan <!-- whois.cctld.uz http://www.noc.uz/whois_result.php3?dname=~DOMAINSUB~ -->
.va : -- Vatican <!-- * *IANA contact does not respond (www.nic.va). -->
.vc : W- Saint Vincent and the Grenadines <!-- whois2.afilias-grs.net *IANA has no contact information for .vc. -->
.ve : W- Venezuela <!-- whois.nic.ve * -->
.vg : W- Virgin Islands (British) <!-- whois.adamsnames.tc * -->
.vi : -w Virgin Islands of the U.S. <!-- * http://www.nic.vi/whoisform.htm -->
.vn : -w Vietnam <!-- * http://www.vnnic.net.vn/dk_tenmien/jsp/tracuu_domain_chitiet.jsp?type=~DOMAIN~ -->
.vu : -w Vanuatu <!-- * http://www.vunic.vu/whois?~DOMAINSUB~ -->
.wf : W- Wallis and Futuna Islands <!-- whois.nic.wf *Has no WHOIS or web-based WHOIS (www.nic.wf). -->
.ws : W- Western Samoa <!-- whois.worldsite.ws * -->
.ye : -- Yemen <!-- * *IANA has no contact information for .ye. -->
.yt : W- Mayotte <!-- whois.nic.yt *Has no WHOIS or web-based WHOIS (www.nic.yt). -->
.yu : -- Yugoslavia <!-- * *www.nic.yu has no WHOIS or web-based WHOIS (only 'yes/no' at www.nic.yu) -->
.co.za: -w South Africa <!-- * http://co.za/cgi-bin/whois.sh?Domain=~DOMAIN~ -->
.za : -w South Africa <!-- * http://whois.co.za/cgi-bin/whois.sh?Domain=~DOMAINSUB~ -->
.zm : -- Zambia <!-- * *Has no WHOIS or web-based WHOIS (www.zamnet.zm). -->
.zw : -- Zimbabwe <!-- * *IANA has no contact information for .zw. -->
 
Last edited by a moderator:
2
•••
Matthew, OUTSTANDING share!!!! Rep up'd

EDIT: Sorry I'm at my limit giving rep for today, but I'll catch up tomorrow.
 
1
•••
. Adam . said:
Suggestion: Transform the entered urls to lowercase ;)

edit: you have already done that, sorry not paying attention lol

I do not transform the urls, i transform the extension when being used as an array key however the urls remain untouched as there is no reason to change them.
 
1
•••
heavy whois lookups?

Can I just make comment? - don't mean to hijack your thread - you should not be using whois lookups to bulk check domain availability - unless you really need all that WHOIS info.

there are better , faster , more network friendly ways

1. for example run your domains through a simple dns check first - if there are dns servers showing , the domain must be registered (reverse not always true). for those with mac osx / linux :

[pbg42:~/Documents] paul% host -t ns nonexistantdomains.com
Host nonexistantdomains.com.lan not found: 3(NXDOMAIN)
[pbg42:~/Documents] paul% host -t ns takendomains.com
takendomains.com name server ns1.hozt.com.
takendomains.com name server ns2.hozt.com.

You can batch this easily with:

foreach var (`cat mylistofdomains.txt`)
host -t ns $var >> dnscheckresults.txt
sleep 1
end

the sleep is there to stop the script from going into meltdown
there are no limits with DNS lookups AFAIK

2. Or for lists with up to 500 keywords at a time of course just use a common bulk availablility check like the one at www.cheapnames.com (under bulk reg)

You can cut/paste and check thousands in a few minutes as cheapnames/godaddy/wwd (and other registrars) maintain their own lists of availability which give near instant results.

dax
 
Last edited:
1
•••
Apologies for the down time I was not even aware to be honest. I have long since left the web development side of my life behind and I'm afraid I no longer hold any active to domains to re-host the script upon nor do I actually have the script any more to my knowledge.

Note I can't support this script via PM any further. Please direct any questions towards this thread, thank you. :)

Matt
 
1
•••
Here's a copy of my own revision, consider it revision 7 :)
 

Attachments

  • bdac.zip
    4.3 KB · Views: 720
Last edited:
0
•••
I've made a few changes and released it online.
A few improvements are:

- Upload a domain list (good when the list is too big);
- Over 100 available TLD's;
- Whois link next to the domains already taken.

Soon I'll be adding Alexa, PR and Yahoo Backlinks count.
Please post your feedback!

Home - Domain Hammer
Great improvement but I found the availability issue. I've checked random 170 LLLL.com and 17 names available. I never see the same result from original version.
 
1
•••
Can you send me a copy of the script? I think I can make that change in a couple of minutes for you...
 
1
•••
Pretty sure this is what you guys/gals are after.
There may be other changes I have made I am not sure.
EDIT: I made it so it would check .org's

Code:
<?php

@set_time_limit(0);

/**
* Bulk domain availablity check script (Revision 7)		
*
* Created  by "Matthew." (up to revision 6) (45276) @ http://namepros.com / http://mattjewell.com
* Modified by "Eric"     (revision 7)       (14781) @ http://namepros.com / http://secondversion.com
*
* Feel free to modify/use however you wish, but keep credit comments in upon distribution.
*/

/**
* Changes by "Eric" (Eric Sizemore)
*
* Revision 7, October 13th, 2009
* -------------------------------------
* - Added blank index pages in the saves and inc directory.
* - Minor enhancements to the php code, to hopefully improve speed.
* - Should be valid HTML now.
*/

require_once('./inc/dnservers.php');

/**
* Saves domain status (available/taken/or invalid) to a text file.
*
* @param  string  Domain status
* @return void
*/
function save_file($status)
{
	global $filename, $domain, $extension;

	$domain = trim($domain);

	if (!($file_handle = @fopen($filename . "_$status.txt", 'a+')))
	{
		trigger_error('Cannot open or create file (chmod?)', E_USER_WARNING);
	}

	if ($status == 'invalid' AND $extension == 'org')
	{
		$status .= ' (.org WHOIS prevents request)';
	}

	if (!fwrite($file_handle, "$domain is $status\n"))
	{
		trigger_error("Results for $domain could not be written.", E_USER_WARNING);
	}
	fclose($file_handle);
}

/**
* Returns domain status (available/taken/or invalid).
*
* @param  string  Domain name
* @param  string  Domain status
* @return void
*/
function return_status($domain, $status)
{
	global $extension, $filename;

	$file = $filename;
	$domain = trim($domain);$buffer

	if (isset($_POST['save']))
	{
		save_file($status);
	}
	else
	{
		$color = ($status == 'available') ? '#008000' : '#FF0000';

		if ($status == 'invalid' AND $extension == 'org')
		{
			$status .= ' (.org WHOIS prevents request)';
		}
		echo "<div style=\"color: $color;\">$domain is $status!</div>\n";
	}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Bulk Domain Availability Check</title>
</head>

<body>

<?php

/** */
if (isset($_POST['submit']))
{
	$filename = 'saves/' . mt_rand(5, 99999999999);

	if (strlen($_POST['domains']) > 0)
	{
		$domains = preg_split("#\n#", trim($_POST['domains']), -1, PREG_SPLIT_NO_EMPTY);

		ob_start();

		echo '<h1>Checking ' . count($domains) . ' domains</h1><br />' . "\n";
		echo (isset($_POST['save'])) ? 'Preparing results, please wait...<br /><br />' . "\n" : '';

		foreach ($domains AS $domain)
		{
			unset($buffer); // clean buffer - prevents problems

			// (replaced str_replace)
			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 AND isset($ext[".$extension"]))
			{
$domain = trim($domain);

if (gethostbynamel($domain) !== false) {

return_status($domain, 'taken');

}
else
{
					      //echo "here3";
				$server = $ext[".$extension"][0];

				if (!($sock = @fsockopen($server, 43)))
				{
					trigger_error("Error Connecting To Server: $server", E_USER_WARNING);
				}

				fputs($sock, "$domain\r\n");

				while (!feof($sock))
				{
					$buffer .= fgets($sock, 128);
				}
				fclose($sock);

				//if ($extension == 'org')
				//{
				//	echo nl2br($buffer);
				//}

				if (substr_count(strtolower($buffer), strtolower($ext[".$extension"][1])) > 0)
				{
					return_status($domain, 'available');
				}
				else
				{
					return_status($domain, 'taken');
				}
			}
}
			else
			{
				if (strlen($domain) > 0)
				{
					return_status($domain, 'invalid');
				}
			}

			ob_flush(); // output before checking next domain
			flush();
			sleep(0.01);
		}

		@ob_end_flush();

		if (isset($_POST['save']) AND count($domains) > 0)
		{
			echo 'Check completed, your results can be found below:' . "\n";

			if (file_exists("{$filename}_available.txt"))
			{
				echo '<br /><a href="' . $filename . '_available.txt">Available domains</a>' . "\n";
			}

			if (file_exists("{$filename}_taken.txt"))
			{
				echo '<br /><a href="' . $filename . '_taken.txt">Taken domains</a>' . "\n";
			}
			else
			{
				echo '<br />0 taken domains found' . "\n";
			}

			if (file_exists("{$filename}_invalid.txt"))
			{
				echo '<br /><a href="' . $filename . '_invalid.txt">Invalid domains (could not be checked)</a>' . "\n";
			}
		}
	}
	else
	{
		echo 'You need to enter one or more domains!';
	}
}
else
{
?>
<div style="text-align: center;">
	<form action="index.php" method="post">
	<p>
		<textarea name="domains" cols="100" rows="20"></textarea><br />
		<input type="checkbox" name="save" id="save" value="save" /> <label for="save">Save results as text file?</label><br /><br />
		<input type="submit" name="submit" value="Check Availability" style="font-size: 30pt;" />
	</p>
	</form>
</div>
<?php
}
?>

</body>
</html>
 
Last edited:
1
•••
Hello, thanks for that great script!
The best whois script i tried until now.
Although i had to make a little fix to make it work with .tk
Here is what i did
At line 126 change the line
Code:
if (gethostbynamel($domain) !== false) {

with
Code:
if (gethostbynamel($domain) !== false AND $extension !== 'tk') {

and it'll work with tk too!

And something else. Org works just fine.

Thanks again
 
1
•••
Hey, that's cool! Install and comment later.
 
0
•••
kleszcz said:
Hey, that's cool! Install and comment later.

Great, simple install - just download and upload both files :)
 
0
•••
Matthew. said:
Great, simple install - just download and upload both files :)

And rename them from .txt to .php :p
 
0
•••
ahtum said:
And rename them from .txt to .php :p

:tu: true, I forgot i renamed them actually. NP wouldn't allow me to upload .php obviously :)
 
0
•••
Thanks
It rock!!!

Rep Added
PS: Can I use it on my blog? You'll get a free link... PM me if interested
 
0
•••
Thanks. Really useful script. :)
 
0
•••
Code has been updated!

The code now outputs the result of the domain check before checking the next one which means real time results!


Demo: http://www.mattjewell.com/dnlookup/index.php

Thanks to those who have rep'd, appreciated :)

Example list to check:
falchion.info
unworthy.info
grandpiano.cc
cannibal.cc
hotwings.cc
newtestament.biz
charityfund.info
channelzero.info
zinfandel.cc
tophost.cc
roadconditions.biz
newtestament.cc
boombox.cc
hyperactive.cc
rejected.cc
babytalk.cc
playhouse.cc
mooncycles.info
restitution.cc
nightmares.cc
doorprize.net
doorprizes.net
 
0
•••
This is a great script! Rep given. Thanks.
 
0
•••
deu12000 said:
This is a great script! Rep given. Thanks.

Thanks!

Code updated, bug fixed.
 
0
•••
Update to dnservers.txt (attached file)

.MOBI Support added!
 
0
•••
is there any way so that the result will be added to a text file automatically?
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back