PHP Whois Script and Server List

Use this PHP class script the whois information for domain names. You can check if a domain is free or you can request the detailed whois information for already registered domain names. The whois information is used by domain name hosting providers or by a user who is looking for a free (or registered) domain name. The PHP Whois script comes with different example files to show you how to use the PHP class for single and multiple domain name requests.

The PHP Whois class works with TLD’s (top-level domain names) where a whois server is available. You can choose which domain name extensions (tld) the script should support. A complete whois server list is attached to this page.

Visit here Script DemoPHP Script Download

How does it work?

Try the basic whois domain example script first.

  1. Create on your web server the following directory structure: Your_Public_Folder/classes/whois/ (Your_Public_Folder is the directory where your site’s homepage is located).
  2. Upload the class file named “whois_class.php” into this newly created directory.
  3. Upload the PHP Whois example file “whois_example.php” to your server as well and access the file in your browser.
  4. Enter into the form field the first part from a domain name and choose an extension from the select menu.
  5. Optional: Use the checkbox “Show all info?” to get also the whois information for a valid domain name.
  6. Click the submit button.

More example files:

multi_whois_list.php and multi_whois_detail.php
These two files check a) multiple domain names in a single request and b) the detail page show the whois detail (if available)

whois_redirect_example.php
This file is an example how to redirect the user to the next page, for example the step2 in a domain name order process.

Adding more tlds

Open the file “server_list.php” and notice that every Whois server entry has three array elements: The whois server name, the “is free” string and an optional parameter (you need to check the specific Whois server website to check if they are required).

Replace xx with your new tld, address is the address you need for your query. The free string is something you can find on the Internet or while using the script name whois_servertest.php

You can add to this list as many TLD’s you need, check the Whois server list below for the details.

Complete Whois server list

TLD Country Whois server Type
ac Ascension Island whois.nic.ac Country Code
academy whois.donuts.co Generic
accountants whois.donuts.co Generic
active whois.afilias-srs.net Generic
actor whois.unitedtld.com Generic
ae United Arab Emirates whois.aeda.net.ae Country Code
aero whois.aero Sponsored
af Afghanistan whois.nic.af Country Code
ag Antigua And Barbuda whois.nic.ag Country Code
agency whois.donuts.co Generic
ai Anguilla whois.ai Country Code
airforce whois.unitedtld.com Generic
am Armenia whois.amnic.net Country Code
archi whois.ksregistry.net Generic
army whois.rightside.co Generic
arpa whois.iana.org Infrastructure
as American Samoa whois.nic.as Country Code
asia whois.nic.asia Sponsored
associates whois.donuts.co Generic
at Austria whois.nic.at Country Code
attorney whois.rightside.co Generic
au Australia whois.audns.net.au Country Code
auction whois.donuts.co Generic
audio whois.uniregistry.net Generic
autos whois.afilias-srs.net Generic
aw Aruba whois.nic.aw Country Code
ax Åland Islands whois.ax Country Code
bar whois.nic.bar Generic
bargains whois.donuts.co Generic
bayern whois-dub.mm-registry.com Generic
be Belgium whois.dns.be Country Code
beer whois-dub.mm-registry.com Generic
berlin whois.nic.berlin Generic
best whois.nic.best Generic
bg Bulgaria whois.register.bg Country Code
bike whois.donuts.co Generic
bio whois.ksregistry.net Generic
bi Burundi whois1.nic.bi Country Code
black whois.afilias.net Generic
blackfriday whois.uniregistry.net Generic
blue whois.afilias.net Generic
biz whois.biz Generic Restricted
bj Benin whois.nic.bj Country Code
bmw whois.ksregistry.net Generic
bn Brunei Darussalam whois.bn Country Code
bo Bolivia whois.nic.bo Country Code
boutique whois.donuts.co Generic
br Brazil whois.registro.br Country Code
brussels whois.nic.brussels Generic
build whois.nic.build Generic
builders whois.donuts.co Generic
bw Botswana whois.nic.net.bw Country Code
bzh whois-bzh.nic.fr Generic
ca Canada whois.cira.ca Country Code
cab whois.donuts.co Generic
camera whois.donuts.co Generic
camp whois.donuts.co Generic
cancerresearch whois.nic.cancerresearch Generic
capetown apetown-whois.registry.net.za Generic
capital whois.donuts.co Generic
cards whois.donuts.co Generic
care whois.donuts.co Generic
career whois.nic.career Generic
careers whois.donuts.co Generic
cash whois.donuts.co Generic
cat whois.cat Sponsored
catering whois.donuts.co Generic
center whois.donuts.co Generic
ceo whois.nic.ceo Generic
cf Central African Republic whois.dot.cf Country Code
ch Switzerland whois.nic.ch Country Code
cheap whois.donuts.co Generic
christmas whois.uniregistry.net Generic
church whois.donuts.co Generic
ci Cote d’Ivoire whois.nic.ci Country Code
city whois.donuts.co Generic
cl Chile whois.nic.cl Country Code
claims whois.donuts.co Generic
cleaning whois.donuts.co Generic
clinic whois.donuts.co Generic
clothing whois.donuts.co Generic
club whois.nic.club Generic
cn China whois.cnnic.cn Country Code
co Colombia whois.nic.co Country Code
codes whois.donuts.co Generic
coffee whois.donuts.co Generic
college whois.centralnic.com Generic
cologne whois-fe1.pdt.cologne.tango.knipp.de Generic
com whois.verisign-grs.com Generic
community whois.donuts.co Generic
company whois.donuts.co Generic
computer whois.donuts.co Generic
condos whois.donuts.co Generic
construction whois.donuts.co Generic
consulting whois.unitedtld.com Generic
contractors whois.donuts.co Generic
cooking whois-dub.mm-registry.com Generic
cool whois.donuts.co Generic
country whois-dub.mm-registry.com Generic
credit whois.donuts.co Generic
creditcard whois.donuts.co Generic
cruises whois.donuts.co Generic
coop whois.nic.coop Sponsored
cuisinella whois.nic.cuisinella Generic
cx Christmas Island whois.nic.cx Country Code
cz Czech Republic whois.nic.cz Country Code
dance whois.unitedtld.com Generic
dating whois.donuts.co Generic
de Germany whois.denic.de Country Code
deals whois.donuts.co Generic
dental whois.donuts.co Generic
degree whois.unitedtld.com Generic
democrat whois.unitedtld.com Generic
dentist whois.unitedtld.com Generic
desi whois.ksregistry.net Generic
diamonds whois.donuts.co Generic
digital whois.donuts.co Generic
direct whois.donuts.co Generic
directory whois.donuts.co Generic
discount whois.donuts.co Generic
dk Denmark whois.dk-hostmaster.dk Country Code
dm Dominica whois.nic.dm Country Code
domains whois.donuts.co Generic
durban durban-whois.registry.net.za Generic
dz Algeria whois.nic.dz Country Code
edu whois.educause.edu Sponsored
ec Ecuador whois.nic.ec Country Code
education whois.donuts.co Generic
ee Estonia whois.tld.ee Country Code
engineer whois.rightside.co Generic
email whois.donuts.co Generic
engineering whois.donuts.co Generic
enterprises whois.donuts.co Generic
equipment whois.donuts.co Generic
estate whois.donuts.co Generic
es Spain whois.nic.es Country Code
eu Europe whois.eu Country Code
eus whois.eus.coreregistry.net Generic
events whois.donuts.co Generic
exchange whois.donuts.co Generic
expert whois.donuts.co Generic
exposed whois.donuts.co Generic
fail whois.donuts.co Generic
farm whois.donuts.co Generic
feedback whois.centralnic.com Generic
fi Finland whois.ficora.fi Country Code
finance whois.donuts.co Generic
financial whois.donuts.co Generic
fish whois.donuts.co Generic
fitness whois.donuts.co Generic
fishing whois-dub.mm-registry.com Generic
flights whois.donuts.co Generic
florist whois.donuts.co Generic
fo Faroe Islands whois.nic.fo Country Code
foo domain-registry-whois.l.google.com Generic
foundation whois.donuts.co Generic
fr France whois.nic.fr Country Code
frogans whois-frogans.nic.fr Generic
fund whois.donuts.co Generic
furniture whois.donuts.co Generic
futbol whois.unitedtld.com Generic
gal whois.gal.coreregistry.net Generic
gallery whois.donuts.co Generic
gd Grenada whois.adamsnames.com Country Code
gent whois.nic.gent Generic
gg Guernsey whois.gg Country Code
gi Gibraltar whois2.afilias-grs.net Country Code
gift whois.uniregistry.net Generic
gives whois.rightside.co Generic
gl Greenland whois.nic.gl Country Code
glass whois.donuts.co Generic
global whois.afilias-srs.net Generic
globo whois.gtlds.nic.br Generic
gop whois-cl01.mm-registry.com Generic
gov whois.dotgov.gov Sponsored
graphics whois.donuts.co Generic
gratis whois.donuts.co Generic
green whois.afilias.net Generic
gripe whois.donuts.co Generic
gs South Georgia And The South Sandwich Islands whois.nic.gs Country Code
guide whois.donuts.co Generic
guitars whois.uniregistry.net Generic
guru whois.donuts.co Generic
gy Guyana whois.registry.gy Country Code
hamburg whois.nic.hamburg Generic
haus whois.unitedtld.com Generic
healthcare whois.donuts.co Generic
hiphop whois.uniregistry.net Generic
hiv whois.afilias-srs.net Generic
hk Hong Kong whois.hkirc.hk Country Code
hn Honduras whois2.afilias-grs.net Country Code
holdings whois.donuts.co Generic
holiday whois.donuts.co Generic
home whois.afilias-srs.net Generic
horse whois-dub.mm-registry.com Generic
host whois.centralnic.com Generic
house whois.donuts.co Generic
hr Croatia whois.dns.hr Country Code
ht Haiti whois.nic.ht Country Code
id Indonesia whois.pandi.or.id Country Code
ie Ireland whois.domainregistry.ie Country Code
il Israel whois.isoc.org.il Country Code
im Isle of Man whois.nic.im Country Code
immobilien whois.unitedtld.com Generic
in India whois.inregistry.net Country Code
industries whois.donuts.co Generic
ink whois.centralnic.com Generic
institute whois.donuts.co Generic
insure whois.donuts.co Generic
int whois.iana.org Sponsored
international whois.donuts.co Generic
investments whois.donuts.co Generic
info whois.afilias.net Generic
io British Indian Ocean Territory whois.nic.io Country Code
iq Iraq whois.cmc.iq Country Code
ir Islamic Republic Of Iran whois.nic.ir Country Code
is Iceland whois.isnic.is Country Code
it Italy whois.nic.it Country Code
je Jersey whois.je Country Code
jobs jobswhois.verisign-grs.com Sponsored
joburg joburg-whois.registry.net.za Generic
jp Japan whois.jprs.jp Country Code
juegos whois.uniregistry.net Generic
kaufen whois.unitedtld.com Generic
ke Kenia whois.kenic.or.ke Country Code
kg Kyrgyzstan whois.domain.kg Country Code
ki Kiribati whois.nic.ki Country Code
kim whois.afilias.net Generic
kitchen whois.donuts.co Generic
kiwi whois.dot-kiwi.com Generic
koeln whois-fe1.pdt.koeln.tango.knipp.de Generic
krd whois.aridnrs.net.au Generic
kr Republic Of Korea whois.kr Country Code
kz Kazakhstan whois.nic.kz Country Code
la People’s Democratic Republic Lao whois.nic.la Country Code
lacaixa whois.nic.lacaixa Generic
land whois.donuts.co Generic
lawyer whois.rightside.co Generic
lease whois.donuts.co Generic
lgbt whois.afilias.net Generic
li Liechtenstein whois.nic.li Country Code
life whois.donuts.co Generic
lighting whois.donuts.co Generic
limited whois.donuts.co Generic
limo whois.donuts.co Generic
link whois.uniregistry.net Generic
loans whois.donuts.co Generic
london whois-lon.mm-registry.com Generic
lotto whois.afilias.net Generic
lt Lithuania whois.domreg.lt Country Code
lu Luxembourg whois.dns.lu Country Code
luxe whois-dub.mm-registry.com Generic
luxury whois.nic.luxury Generic
lv Latvia whois.nic.lv Country Code
ly Libya whois.nic.ly Country Code
ma Morocco whois.iam.net.ma Country Code
maison whois.donuts.co Generic
management whois.donuts.co Generic
mango whois.mango.coreregistry.net Generic
market whois.rightside.co Generic
marketing whois.donuts.co Generic
md Republic Of Moldova whois.nic.md Country Code
me Montenegro whois.nic.me Country Code
media whois.donuts.co Generic
meet whois.afilias.net Generic
melbourne whois.aridnrs.net.au Generic
menu whois.nic.menu Generic
mg Madagascar whois.nic.mg Country Code
miami whois-dub.mm-registry.com Generic
mini whois.ksregistry.net Generic
mk The Former Yugoslav Republic Of Macedonia whois.marnet.mk Country Code
ml Mali whois.dot.ml Country Code
mn Mongolia whois.nic.mn Country Code
mo Macao whois.monic.mo Country Code
mobi whois.dotmobiregistry.net Generic
moda whois.unitedtld.com Generic
monash whois.nic.monash Generic
mortgage whois.rightside.co Generic
moscow whois.nic.moscow Generic
motorcycles whois.afilias-srs.net Generic
mp Northern Mariana Islands whois.nic.mp Country Code
ms Montserrat whois.nic.ms Country Code
mu Mauritius whois.nic.mu Country Code
museum whois.museum Sponsored
mx Mexico whois.mx Country Code
my Malaysia whois.mynic.my Country Code
na Namibia whois.na-nic.com.na Country Code
name whois.nic.name Generic Restricted
navy whois.rightside.co Generic
nc New Caledonia whois.nc Country Code
net whois.verisign-grs.com Generic
nf Norfolk Island whois.nic.nf Country Code
ng Nigeria whois.nic.net.ng Country Code
ngo whois.publicinterestregistry.net Generic
ninja whois.unitedtld.com Generic
nl The Netherlands whois.domain-registry.nl Country Code
no Norway whois.norid.no Country Code
nra whois.afilias-srs.net Generic
nrw whois-fe1.pdt.nrw.tango.knipp.de Generic
nu Niue whois.iis.nu Country Code
nz New Zealand whois.srs.net.nz Country Code
om Oman whois.registry.om Country Code
onl whois.afilias-srs.net Generic
org whois.pir.org Generic
organic whois.afilias.net Generic
ovh whois-ovh.nic.fr Generic
paris whois-paris.nic.fr Generic
partners whois.donuts.co Generic
parts whois.donuts.co Generic
pe Peru kero.yachay.pe Country Code
pf French Polynesia whois.registry.pf Country Code
photo whois.uniregistry.net Generic
photography whois.donuts.co Generic
photos whois.donuts.co Generic
physio whois.nic.physio Generic
pics whois.uniregistry.net Generic
pictures whois.donuts.co Generic
pink whois.afilias.net Generic
pl Poland whois.dns.pl Country Code
place whois.donuts.co Generic
plumbing whois.donuts.co Generic
pm Saint Pierre and Miquelon whois.nic.pm Country Code
post whois.dotpostregistry.net Sponsored
pr Puerto Rico whois.nic.pr Country Code
press whois.centralnic.com Generic
pro whois.dotproregistry.net Generic-restricted
productions whois.donuts.co Generic
properties whois.donuts.co Generic
pt Portugal whois.dns.pt Country Code
pub whois.unitedtld.com Generic
pw Palau whois.nic.pw Country Code
qa Qatar whois.registry.qa Country Code
quebec whois.quebec.rs.corenic.net Generic
re Réunion whois.nic.re Country Code
recipes whois.donuts.co Generic
red whois.afilias.net Generic
rehab whois.rightside.co Generic
reise whois.nic.reise Generic
reisen whois.donuts.co Generic
rentals whois.donuts.co Generic
repair whois.donuts.co Generic
report whois.donuts.co Generic
republican whois.rightside.co Generic
rest whois.centralnic.com Generic
review whois.unitedtld.com Generic
rich whois.afilias-srs.net Generic
rio whois.gtlds.nic.br Generic
ro Romania whois.rotld.ro Country Code
rocks whois.unitedtld.com Generic
rodeo whois-dub.mm-registry.com Generic
rs Serbia whois.rnids.rs Country Code
ru Russian Federation whois.tcinet.ru Country Code
ruhr whois.nic.ruhr Generic
sa Saudi Arabia whois.nic.net.sa Country Code
saarland whois.ksregistry.net Generic
sb Solomon Islands whois.nic.net.sb Country Code
sc Seychelles whois2.afilias-grs.net Country Code
scb whois.nic.scb Generic
schmidt whois.nic.schmidt Generic
schule whois.donuts.co Generic
scot whois.scot.coreregistry.net Generic
se Sweden whois.iis.se Country Code
services whois.donuts.co Generic
sexy whois.uniregistry.net Generic
sg Singapore whois.sgnic.sg Country Code
sh Ascension And Tristan Da Cunha Saint Helena whois.nic.sh Country Code
shiksha whois.afilias.net Generic
shoes whois.donuts.co Generic
si Slovenia whois.arnes.si Country Code
singles whois.donuts.co Generic
sk Slovakia whois.sk-nic.sk Country Code
sm San Marino whois.nic.sm Country Code
sn Senegal whois.nic.sn Country Code
so Somalia whois.nic.so Country Code
social whois.unitedtld.com Generic
software whois.rightside.co Generic
solar whois.donuts.co Generic
solutions whois.donuts.co Generic
soy domain-registry-whois.l.google.com Generic
space whois.nic.space Generic
spiegel whois.ksregistry.net Generic
st Sao Tome And Principe whois.nic.st Country Code
su Soviet Union whois.tcinet.ru Country Code
supplies whois.donuts.co Generic
supply whois.donuts.co Generic
support whois.donuts.co Generic
surf whois-dub.mm-registry.com Generic
surgery whois.donuts.co Generic
sx Sint Maarten whois.sx Country Code
sy Syrian Arab Republic whois.tld.sy Country Code
systems whois.donuts.co Generic
tattoo whois.uniregistry.net Generic
tax whois.donuts.co Generic
tc Turks And Caicos Islands whois.meridiantld.net Country Code
technology whois.donuts.co Generic
tel whois.nic.tel Sponsored
tf French Southern and Antarctic Lands whois.nic.tf Country Code
th Thailand whois.thnic.co.th Country Code
tienda whois.donuts.co Generic
tips whois.donuts.co Generic
tirol whois.nic.tirol Generic
tk Tokelau whois.dot.tk Country Code
tl Timor-leste whois.nic.tl Country Code
tm Turkmenistan whois.nic.tm Country Code
tn Tunisia whois.ati.tn Country Code
to Tonga whois.tonic.to Country Code
today whois.donuts.co Generic
tools whois.donuts.co Generic
top whois.nic.top Generic
town whois.donuts.co Generic
toys whois.donuts.co Generic
tr Turkey whois.nic.tr Country Code
training whois.donuts.co Generic
travel whois.nic.travel Sponsored
tv Tuvalu tvwhois.verisign-grs.com Country Code
tw Taiwan whois.twnic.net.tw Country Code
tz United Republic Of Tanzania whois.tznic.or.tz Country Code
ua Ukraine whois.ua Country Code
ug Uganda whois.co.ug Country Code
uk United Kingdom whois.nic.uk Country Code
university whois.donuts.co Generic
us United States of America whois.nic.us Country Code
uy Uruguay whois.nic.org.uy Country Code
uz Uzbekistan whois.cctld.uz Country Code
vacations whois.donuts.co Generic
vc Saint Vincent And The Grenadines whois2.afilias-grs.net Country Code
ve Bolivarian Republic Of Venezuela whois.nic.ve Country Code
vegas whois.afilias-srs.net Generic
ventures whois.donuts.co Generic
versicherung whois.nic.versicherung Generic
vet whois.rightside.co Generic
vg British Virgin Islands ccwhois.ksregistry.net Country Code
viajes whois.donuts.co Generic
villas whois.donuts.co Generic
vision whois.donuts.co Generic
vlaanderen whois.nic.vlaanderen Generic
vodka whois-dub.mm-registry.com Generic
vote whois.afilias.net Generic
voting whois.voting.tld-box.at Generic
voto whois.afilias.net Generic
voyage whois.donuts.co Generic
vu Vanuatu vunic.vu Country Code
wales whois.nic.wales Generic
wang whois.gtld.knet.cn Generic
watch whois.donuts.co Generic
website whois.nic.website Generic
wed whois.nic.wed Generic
wf Wallis and Futuna Islands whois.nic.wf Country Code
wien whois.nic.wien Generic
wiki whois.nic.wiki Generic
works whois.donuts.co Generic
ws Samoa whois.website.ws Country Code
wtc whois.nic.wtc Generic
wtf whois.donuts.co Generic
xxx whois.nic.xxx Sponsored
xyz whois.nic.xyz Generic
yachts whois.afilias-srs.net Generic
yt Mayotte whois.nic.yt Country Code
zm Zambia whois.nic.zm Country Code
zone whois.donuts.co Generic

Disclaimer: The data from this list is based on the information provided by the root zone database on IANA.org. There is no guaranty that all information on this list is correct and/or complete. We advice to check also the registry information before you use the information in your own whois script. Please report missing or wrong data by using our contact form.

Whois server test

There is a small script that you can use to check the response for a query with each whois server. Open the file “whois_servertest.php” and change the value for the whois server and domain name. Run the PHP script in your browser or from the command line.

Change log for the PHP Whois script

Version 1.22

Added additional whois server settings (.eu, .us) and the regex pattern is more improved.

Version 1.21

There was small problem if the user requests data about .de domein (denic), the exec function will not work for this kind of tld. I put in the method get_whois_data() an if clause to use for this kind of tld always a socket connection.

Version 1.20

I changed in this class the simple domain check and the method to obtain whois data, because there are several problems with timeouts by calling the whois servers. In this version there are two ways to get the whois data: the old method with fsockopen and (new) via the linux command line with the command “whois -h”. The last one is much faster and uses features like re-directing. The class is modified to handle .nl queries while using the “is” parameter.

Version 1.13

I added a boolean to the check_only() method to use this information for domain register pages. You can use this “bool” to redirect to an other page (to sell the free name f.e.).

Version 1.12

I changed the get_whois_data() and the check_only() method, because the information was not right if there was no server connection. This class works now for PHP with the setting register_globals = off.

Version 1.11

I added the var $whois_param, use this var via the serverlist to use extra (required) parameters for some whois servers.

Version 1.10

In this version is it possible to check domain names for all tld’s which are configured inside the server list. New Files: “multi_whois_list.php” this file is an example for using the new functions and is also an extended version of the main class. “multi_whois_detail.php” you need this file to get detail information ondomain names checked with the list file.