IT.COM

PHP: Bulk domain availability check!

Spaceship Spaceship
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.
Made a few changes...

index.php
PHP:
<?php

set_time_limit(0);
ob_start();

/* 	--------	Bulk domain availablity check script (Revision 4) ------------		
[																					
[ 	Created by "Matthew." (45276) @ http://namepros.com / http://mattjewell.com		
[	Feel free to modify/use however you wish,										
[	but keep credit comments in upon distribution.								
*/
require_once('./inc/dnservers.php');

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

	$domain = trim($domain);

	// Let's try to chmod ourselves, before warning them they need to do so
	if (!($file_handle = @fopen($filename . "_$status.txt", 'a+')))
	{
		@touch($filename . "_$status.txt");
		@chmod($filename . "_$status.txt", 0666);

		// Try again..
		if (!($file_handle = @fopen($filename . "_$status.txt", 'a+')))
		{
			trigger_error('Cannot open or create file (chmod?)', E_USER_WARNING);
		}
	}
	$status .= ($status == 'invalid' AND $extension == 'org') ? ' (.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);
	return;
}

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

	$domain = trim($domain);

	if (isset($_POST['save']))
	{
		save_file($status);
	}
	else
	{
		$color = ($status == 'available') ? '55BB11' : 'E51417';
		$status .= ($status == 'invalid' AND $extension == 'org') ? ' (.org WHOIS prevents request)' : '';
		echo "<div style=\"color: #$color;\">$domain is $status!</div>";
	}
	return;
}

if (isset($_POST['submit']))
{
	if (version_compare(PHP_VERSION, '4.2.0', '<='))
	{
		mt_srand((double)microtime() * 1000000);
	}
	$filename = 'saves/' . mt_rand(5, mt_getrandmax());

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

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

		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 array_key_exists(".$extension", $ext))
			{
				$server = $ext[".$extension"][0];

				$sock = fsockopen($server, 43) or trigger_error("Error Connecting To Server: $server", E_USER_ERROR);
				fputs($sock, "$domain\r\n");

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

				if ($extension == 'org')
				{
					echo nl2br($buffer);
				}
				return_status($domain, (ereg($ext[".$extension"][1], $buffer) ? 'available' : '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']) AND 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
}
?>

http://www.phpsociety.com/dbulk/
 
0
•••
Thanks SecondVersion ;)

Feel free to contribute everyone, i no longer have time to do any coding because of exams/coursework etc.

Matt
 
0
•••
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
•••
wowie... the biggest list i have ever seen... add some reps to u
 
0
•••
Can you make it so that you type it in, and then click the extensions from a drop down box,

also can you make it search the following extensions:

.com
.net
.org
.info
.biz
.us
.name
.in
.co.in
.net.in
.org.in
.gen.in
.firm.in
.ind.in
.cc
.tv
.mn
.bz
.mobi
.ws
 
0
•••
hi

i found this code snippet to use proxies in php... please can someone integrate this into the script?? so that the script again starts working for .com, .net. and most importantly .org domains

thanks

Code:
<?php
function proxy_url($proxy_url)
{
    $proxy_name = '127.0.0.1';
    $proxy_port = 4001;
    $proxy_cont = '';

    $proxy_fp = fsockopen($proxy_name, $proxy_port);
    if (!$proxy_fp)    {return false;}
    fputs($proxy_fp, "GET $proxy_url HTTP/1.0\r\nHost: $proxy_name\r\n\r\n");
    while(!feof($proxy_fp)) {$proxy_cont .= fread($proxy_fp,4096);}
    fclose($proxy_fp);
    $proxy_cont = substr($proxy_cont, strpos($proxy_cont,"\r\n\r\n")+4);
    return $proxy_cont;
} 
?>
i guess this should work..
 
0
•••
I cannot do anything now, it is easter holidays and i am spending 8am - 1pm revising, 2pm - 4pm doing what i want and then back to working and revising for the night.

My exams begin in about 3 weeks.

Also that code uses a single proxy, the IP would be restricted just as any other would be. It would have to use a variety of IPs which is simple enough to do but still presents the problem of gathering a reliable proxy list.

Matt
 
0
•••
1. Matt i perfectly understand that u r busy.. that is why in my original post i mentioned "somebody" can do so and not u... ;)

2. the coder can create some sort of a proxy rotation script which changes $proxy_name for each checkup.. that should not be a tough job..good proxy lists are available on the net.. u can create a simple text box for advance users who can enter their own proxy lists themselves :) .. http://www.google.com/search?q=proxy+lists&sourceid=opera&num=0&ie=utf-8&oe=utf-8 always rocks..

3. sorry if am not making much sense.. i was just trying to make the script more beneficial for users as well as me..
 
0
•••
The idea in theory is good, and it's probably what i would have done (using cURL instead), and sorry for not reading the "someone", i do tend to skip things and since i get email alerts to this topic i always associate it with myself lol.

Everybody is free to contribute and or rip the script right apart. It was never coded well and perhaps i will re do it one day but until then im taking off the email subscription to this lol ;)

Matt
 
0
•••
Hi, script is great but : ;)

Many times for dot .pl i have:

Warning: fsockopen() [function.fsockopen]: unable to connect to whois.dns.pl:43 in /home/mattjew/public_html/namepros/dnlookup/index.php on line 82
Error Connecting To Server:whois.dns.pl

And sometimes result are not true eg:
dsadasdasasdasda.pl is taken!

I think thats because polish whois database is limited (100 questions per 24/h)
 
0
•••
Quite probable :)

I will rewrite this script properly in a month or two after my exams - Look out for it ;)

Matt
 
0
•••
You think you can bypass limit for IP 100quest/24h?
I'll can in next 3 months go back there and use your script and check 10.000 domains .pl? :)
 
0
•••
Matthew. said:
- Will now output result before checking next domain (much faster)
i tried just about everything on my server and in the code but i couldn't get this to work, the only change that worked for me was changing
Code:
ob_start();
to
Code:
if (ob_get_level() == 0) ob_start();
 
0
•••
Very good script Matt.

Working on my birthday so to kill time made a very dirty change. Added option to only displays available domains and price guide to simplify buying. After the domain check I use the enom api to buy the domain but removed for post. Got a range check and a roller but had problems so not added yet.

PHP:
<?php
set_time_limit(0);
ob_start();
/* 	--------	Bulk domain availablity check script (Revision 4) ------------		
[																					
[ 	Created by "Matthew." (45276) @ http://namepros.com / http://mattjewell.com		
[	Feel free to modify/use however you wish,										
[	but keep credit comments in upon distribution.								
[	
[	Edited 20/04/2007
 	by "Darren" @ http://www.pdhosting.net / http://www.fxhost.net
 	Added simple price check and available only
*/

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)'; }	
			
		if(isset($_POST['onlyfree']))
		{
		if($status == 'available') { echo "<div style=\"color: $color\">$domain is $status! <a href='http://leapfish.com/domain_name_appraisal.php?url=$domain'>price check</a></div>"; }
		}
		else
		{
		if($status == 'available') { echo "<div style=\"color: $color\">$domain is $status! <a href='http://leapfish.com/domain_name_appraisal.php?url=$domain'>price check</a></div>"; }
		if($status == 'taken') { 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="index2.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="checkbox" name="onlyfree" value="onlyfree" /> Display only available domains?<br />
		<br /><input type="submit" name="submit" value="Check Availability" style="font-size: 30pt;" />
		
	</form>
</div>
	<?php
}
?>
 
Last edited:
0
•••
I know this is a domain checker, but with some modification I rewrote it into a tool that with the help of a cron event can be used to monitor domains and email you (possibly text message too) when it is free to register.

Very very simple to use.

  1. Get the list of domains you want to monitor and enter them one line at a time in the domains.txt file, make sure the file is saved using ISO 8859-2 / Dos character encoding. For some reason if I use others the @file command does not read in the domains properly into the array.
  2. Open up index.php and enter your email in the place it is asking for you email address.
  3. Set up a CRON event to run the index.php the amount of times a day you want to check for the domains in the text file. If you know it is going to drop anytime soon, I would set it for every hour or maybe 10 minutes if it is really close to dropping.

*In place of the email enter your TEXT message email address and it will email you cell phone instead. :) Instant notification?? I have t-moblie. So I enter MYCELLPHONE###@momail.com and it sending me a text message.

The software is setup only to email if one is free to register. I striped out the output of taken and invalid and saving to a text file. So, basically it checks a list for free domains. If any free domains are found it will email you.

Rep if you like it. I thought it would be a nifty tool to use. :)


If you don't mind I am going to post this in the free resources as it's own topic and give a link to this thread with credit. :)

.
 
Last edited:
0
•••
I am sorry to bring an old thread back but I've been trying to find a way of finding the PR of the domains that are scanned and displaying them as they are show. However I couldn't do it.

Can anyone do it?

Here is what I have at the moment:

PHP:
<?php
set_time_limit(0);
ob_start();
include 'dnservers.php';
include "func.php";


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

    $domain = trim($domain);
    
        $color = ($status == 'available') ? 'green' : 'red';
        if($status == 'invalid' && $extension == 'org') { $status .= ' (.org WHOIS prevents request)'; }    
            
        if($status == 'available'){
	
	$locdomain = $domain;
    $location = $domain;
    $locdomain = str_replace("http://", "", $locdomain);
    $locdomain = str_replace("www.", "", $locdomain);
    $oPR=new PageRankXor32();
        
            $aUrl=explode("\n",$location);
            //Step thru array of urls
            foreach ($aUrl as $location) {
                //Trim off any whitespace
                $location=trim($location);
                //Ignore blank lines
                if ($location!='') {
                    if (isUrlValid($location)) {
                        $PageRank =$oPR->getRank($location);
                        ++$locationCount;
                    } else {
                        $PageRank =$BadUrlText;
                    }
                }
                //Limit the number of urls allowed
                if ($locationCount >= $MaxUrls) {
                    break;
                }
            }
        echo "<div style=\"color: $color\">$domain has PR: $PageRank</div>";
		}else{
		echo"";
		}
}   

if(isset($_POST['submit']))
{
        
    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);
        }
		}
        
}else{
    ?>
	<div style="text-align: center">
    <form action="domainavail new.php" method="post">
        <textarea name="domains" cols="100" rows="20"></textarea>
        <br />
    <br />
        <br /><input type="submit" name="submit" value="Check Availability" style="font-size: 30pt;" />
        
    </form>
</div>
    <?php
}
?>

Any help would be greatly appreciated
 
0
•••
I've love this script and have gotten plenty of use out of it until it started returning errors earlier today. Anyone care to take a crack at pointing it towards another server.

Warning: fsockopen(): unable to connect to whois.crsnic.net:43 in index.php on line 79 Error Connecting To Server:whois.crsnic.net

:'(

-Bill
 
0
•••
Means that WHOIS server cannot be found... Try changing it to an alternative one or don't scan that extension, or just wait till it comes online.
 
0
•••
My suggestion

We can find domain availability using http://www.name.com/xml.php?domain=namepros.com. If output after comma is 0 then domain not available and if it is 1 then it is available.

Name.com supports more then 50 extensions.

Some one Please integrate this method.

What you say?

Rajesh
 
0
•••
rajesh_ said:
My suggestion

We can find domain availability using http://www.name.com/xml.php?domain=namepros.com. If output after comma is 0 then domain not available and if it is 1 then it is available.

Name.com supports more then 50 extensions.

Some one Please integrate this method.

What you say?

Rajesh

That's much worse, the current script directly pings the WHOIS server, a much quicker method, you just need to ensure the WHOIS list is up to date
 
0
•••
Heyho again.

Not promising but am looking to maybe rewrite this to make it much better during feb half term (work load permitting!) so anything anyone wants feature wise please post in the topic!

I probably will not implement a way to get around the WHOIS limits as on retrospect those limits are there for a reason, and would rather not abuse them.

Also, found this link which is apparently a modded version of my script fixing some bugs...making it prettier heh but yeah check it out (found the link via my referrers not sure if it's posted anywhere here).
 
0
•••
Nice Tool mathew. Can it check like a few thousand names without being hang or blocked by whois server?
 
0
•••
touchring said:
Nice Tool mathew. Can it check like a few thousand names without being hang or blocked by whois server?

Yes and no. Most if not all WHOIS servers have a limit ranging from a few thousand, hundred, tens etc of domains without a time period.

You're free to try it out (or even use it permanently) on the demo here: http://mattjewell.com/namepros/dnlookup should you want.
 
0
•••
Matthew. said:
Yes and no. Most if not all WHOIS servers have a limit ranging from a few thousand, hundred, tens etc of domains without a time period.

You're free to try it out (or even use it permanently) on the demo here: http://mattjewell.com/namepros/dnlookup should you want.


Thanks. I tried with 2000, it doesn't work. :td:

Since we're just checking availability, not whois info, it should be able to detect availability even if limited? Because I used a windows whois tool, and if the limit has been used up, it will show a different message than if the name does not exist.
 
0
•••
touchring said:
I tried with 2000, it doesn't work. We're just checking availability, not whois info, it should be able to detect availability even if limited?

It makes a query to the WHOIS server which counts as...well....one query. To truly check availability you need to take the response from the WHOIS server not just open connection to the domain (otherwise when sites are down they would show as available and so on)
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back