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 the 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

TLDCountryWhois serverType
acAscension Islandwhois.nic.acCountry Code
academywhois.donuts.coGeneric
accountantswhois.donuts.coGeneric
activewhois.afilias-srs.netGeneric
actorwhois.unitedtld.comGeneric
aeUnited Arab Emirateswhois.aeda.net.aeCountry Code
aerowhois.aeroSponsored
afAfghanistanwhois.nic.afCountry Code
agAntigua And Barbudawhois.nic.agCountry Code
agencywhois.donuts.coGeneric
aiAnguillawhois.aiCountry Code
airforcewhois.unitedtld.comGeneric
amArmeniawhois.amnic.netCountry Code
archiwhois.ksregistry.netGeneric
armywhois.rightside.coGeneric
arpawhois.iana.orgInfrastructure
asAmerican Samoawhois.nic.asCountry Code
asiawhois.nic.asiaSponsored
associateswhois.donuts.coGeneric
atAustriawhois.nic.atCountry Code
attorneywhois.rightside.coGeneric
auAustraliawhois.audns.net.auCountry Code
auctionwhois.donuts.coGeneric
audiowhois.uniregistry.netGeneric
autoswhois.afilias-srs.netGeneric
awArubawhois.nic.awCountry Code
axÅland Islandswhois.axCountry Code
barwhois.nic.barGeneric
bargainswhois.donuts.coGeneric
bayernwhois-dub.mm-registry.comGeneric
beBelgiumwhois.dns.beCountry Code
beerwhois-dub.mm-registry.comGeneric
berlinwhois.nic.berlinGeneric
bestwhois.nic.bestGeneric
bgBulgariawhois.register.bgCountry Code
bikewhois.donuts.coGeneric
biowhois.ksregistry.netGeneric
biBurundiwhois1.nic.biCountry Code
blackwhois.afilias.netGeneric
blackfridaywhois.uniregistry.netGeneric
bluewhois.afilias.netGeneric
bizwhois.bizGeneric Restricted
bjBeninwhois.nic.bjCountry Code
bmwwhois.ksregistry.netGeneric
bnBrunei Darussalamwhois.bnCountry Code
boBoliviawhois.nic.boCountry Code
boutiquewhois.donuts.coGeneric
brBrazilwhois.registro.brCountry Code
brusselswhois.nic.brusselsGeneric
buildwhois.nic.buildGeneric
builderswhois.donuts.coGeneric
bwBotswanawhois.nic.net.bwCountry Code
bzhwhois-bzh.nic.frGeneric
caCanadawhois.cira.caCountry Code
cabwhois.donuts.coGeneric
camerawhois.donuts.coGeneric
campwhois.donuts.coGeneric
cancerresearchwhois.nic.cancerresearchGeneric
capetownapetown-whois.registry.net.zaGeneric
capitalwhois.donuts.coGeneric
cardswhois.donuts.coGeneric
carewhois.donuts.coGeneric
careerwhois.nic.careerGeneric
careerswhois.donuts.coGeneric
cashwhois.donuts.coGeneric
catwhois.catSponsored
cateringwhois.donuts.coGeneric
centerwhois.donuts.coGeneric
ceowhois.nic.ceoGeneric
cfCentral African Republicwhois.dot.cfCountry Code
chSwitzerlandwhois.nic.chCountry Code
cheapwhois.donuts.coGeneric
christmaswhois.uniregistry.netGeneric
churchwhois.donuts.coGeneric
ciCote d’Ivoirewhois.nic.ciCountry Code
citywhois.donuts.coGeneric
clChilewhois.nic.clCountry Code
claimswhois.donuts.coGeneric
cleaningwhois.donuts.coGeneric
clinicwhois.donuts.coGeneric
clothingwhois.donuts.coGeneric
clubwhois.nic.clubGeneric
cnChinawhois.cnnic.cnCountry Code
coColombiawhois.nic.coCountry Code
codeswhois.donuts.coGeneric
coffeewhois.donuts.coGeneric
collegewhois.centralnic.comGeneric
colognewhois-fe1.pdt.cologne.tango.knipp.deGeneric
comwhois.verisign-grs.comGeneric
communitywhois.donuts.coGeneric
companywhois.donuts.coGeneric
computerwhois.donuts.coGeneric
condoswhois.donuts.coGeneric
constructionwhois.donuts.coGeneric
consultingwhois.unitedtld.comGeneric
contractorswhois.donuts.coGeneric
cookingwhois-dub.mm-registry.comGeneric
coolwhois.donuts.coGeneric
countrywhois-dub.mm-registry.comGeneric
creditwhois.donuts.coGeneric
creditcardwhois.donuts.coGeneric
cruiseswhois.donuts.coGeneric
coopwhois.nic.coopSponsored
cuisinellawhois.nic.cuisinellaGeneric
cxChristmas Islandwhois.nic.cxCountry Code
czCzech Republicwhois.nic.czCountry Code
dancewhois.unitedtld.comGeneric
datingwhois.donuts.coGeneric
deGermanywhois.denic.deCountry Code
dealswhois.donuts.coGeneric
dentalwhois.donuts.coGeneric
degreewhois.unitedtld.comGeneric
democratwhois.unitedtld.comGeneric
dentistwhois.unitedtld.comGeneric
desiwhois.ksregistry.netGeneric
diamondswhois.donuts.coGeneric
digitalwhois.donuts.coGeneric
directwhois.donuts.coGeneric
directorywhois.donuts.coGeneric
discountwhois.donuts.coGeneric
dkDenmarkwhois.dk-hostmaster.dkCountry Code
dmDominicawhois.nic.dmCountry Code
domainswhois.donuts.coGeneric
durbandurban-whois.registry.net.zaGeneric
dzAlgeriawhois.nic.dzCountry Code
eduwhois.educause.eduSponsored
ecEcuadorwhois.nic.ecCountry Code
educationwhois.donuts.coGeneric
eeEstoniawhois.tld.eeCountry Code
engineerwhois.rightside.coGeneric
emailwhois.donuts.coGeneric
engineeringwhois.donuts.coGeneric
enterpriseswhois.donuts.coGeneric
equipmentwhois.donuts.coGeneric
estatewhois.donuts.coGeneric
esSpainwhois.nic.esCountry Code
euEuropewhois.euCountry Code
euswhois.eus.coreregistry.netGeneric
eventswhois.donuts.coGeneric
exchangewhois.donuts.coGeneric
expertwhois.donuts.coGeneric
exposedwhois.donuts.coGeneric
failwhois.donuts.coGeneric
farmwhois.donuts.coGeneric
feedbackwhois.centralnic.comGeneric
fiFinlandwhois.ficora.fiCountry Code
financewhois.donuts.coGeneric
financialwhois.donuts.coGeneric
fishwhois.donuts.coGeneric
fitnesswhois.donuts.coGeneric
fishingwhois-dub.mm-registry.comGeneric
flightswhois.donuts.coGeneric
floristwhois.donuts.coGeneric
foFaroe Islandswhois.nic.foCountry Code
foodomain-registry-whois.l.google.comGeneric
foundationwhois.donuts.coGeneric
frFrancewhois.nic.frCountry Code
froganswhois-frogans.nic.frGeneric
fundwhois.donuts.coGeneric
furniturewhois.donuts.coGeneric
futbolwhois.unitedtld.comGeneric
galwhois.gal.coreregistry.netGeneric
gallerywhois.donuts.coGeneric
gdGrenadawhois.adamsnames.comCountry Code
gentwhois.nic.gentGeneric
ggGuernseywhois.ggCountry Code
giGibraltarwhois2.afilias-grs.netCountry Code
giftwhois.uniregistry.netGeneric
giveswhois.rightside.coGeneric
glGreenlandwhois.nic.glCountry Code
glasswhois.donuts.coGeneric
globalwhois.afilias-srs.netGeneric
globowhois.gtlds.nic.brGeneric
gopwhois-cl01.mm-registry.comGeneric
govwhois.dotgov.govSponsored
graphicswhois.donuts.coGeneric
gratiswhois.donuts.coGeneric
greenwhois.afilias.netGeneric
gripewhois.donuts.coGeneric
gsSouth Georgia And The South Sandwich Islandswhois.nic.gsCountry Code
guidewhois.donuts.coGeneric
guitarswhois.uniregistry.netGeneric
guruwhois.donuts.coGeneric
gyGuyanawhois.registry.gyCountry Code
hamburgwhois.nic.hamburgGeneric
hauswhois.unitedtld.comGeneric
healthcarewhois.donuts.coGeneric
hiphopwhois.uniregistry.netGeneric
hivwhois.afilias-srs.netGeneric
hkHong Kongwhois.hkirc.hkCountry Code
hnHonduraswhois2.afilias-grs.netCountry Code
holdingswhois.donuts.coGeneric
holidaywhois.donuts.coGeneric
homewhois.afilias-srs.netGeneric
horsewhois-dub.mm-registry.comGeneric
hostwhois.centralnic.comGeneric
housewhois.donuts.coGeneric
hrCroatiawhois.dns.hrCountry Code
htHaitiwhois.nic.htCountry Code
idIndonesiawhois.pandi.or.idCountry Code
ieIrelandwhois.domainregistry.ieCountry Code
ilIsraelwhois.isoc.org.ilCountry Code
imIsle of Manwhois.nic.imCountry Code
immobilienwhois.unitedtld.comGeneric
inIndiawhois.inregistry.netCountry Code
industrieswhois.donuts.coGeneric
inkwhois.centralnic.comGeneric
institutewhois.donuts.coGeneric
insurewhois.donuts.coGeneric
intwhois.iana.orgSponsored
internationalwhois.donuts.coGeneric
investmentswhois.donuts.coGeneric
infowhois.afilias.netGeneric
ioBritish Indian Ocean Territorywhois.nic.ioCountry Code
iqIraqwhois.cmc.iqCountry Code
irIslamic Republic Of Iranwhois.nic.irCountry Code
isIcelandwhois.isnic.isCountry Code
itItalywhois.nic.itCountry Code
jeJerseywhois.jeCountry Code
jobsjobswhois.verisign-grs.comSponsored
joburgjoburg-whois.registry.net.zaGeneric
jpJapanwhois.jprs.jpCountry Code
juegoswhois.uniregistry.netGeneric
kaufenwhois.unitedtld.comGeneric
keKeniawhois.kenic.or.keCountry Code
kgKyrgyzstanwhois.domain.kgCountry Code
kiKiribatiwhois.nic.kiCountry Code
kimwhois.afilias.netGeneric
kitchenwhois.donuts.coGeneric
kiwiwhois.dot-kiwi.comGeneric
koelnwhois-fe1.pdt.koeln.tango.knipp.deGeneric
krdwhois.aridnrs.net.auGeneric
krRepublic Of Koreawhois.krCountry Code
kzKazakhstanwhois.nic.kzCountry Code
laPeople’s Democratic Republic Laowhois.nic.laCountry Code
lacaixawhois.nic.lacaixaGeneric
landwhois.donuts.coGeneric
lawyerwhois.rightside.coGeneric
leasewhois.donuts.coGeneric
lgbtwhois.afilias.netGeneric
liLiechtensteinwhois.nic.liCountry Code
lifewhois.donuts.coGeneric
lightingwhois.donuts.coGeneric
limitedwhois.donuts.coGeneric
limowhois.donuts.coGeneric
linkwhois.uniregistry.netGeneric
loanswhois.donuts.coGeneric
londonwhois-lon.mm-registry.comGeneric
lottowhois.afilias.netGeneric
ltLithuaniawhois.domreg.ltCountry Code
luLuxembourgwhois.dns.luCountry Code
luxewhois-dub.mm-registry.comGeneric
luxurywhois.nic.luxuryGeneric
lvLatviawhois.nic.lvCountry Code
lyLibyawhois.nic.lyCountry Code
maMoroccowhois.iam.net.maCountry Code
maisonwhois.donuts.coGeneric
managementwhois.donuts.coGeneric
mangowhois.mango.coreregistry.netGeneric
marketwhois.rightside.coGeneric
marketingwhois.donuts.coGeneric
mdRepublic Of Moldovawhois.nic.mdCountry Code
meMontenegrowhois.nic.meCountry Code
mediawhois.donuts.coGeneric
meetwhois.afilias.netGeneric
melbournewhois.aridnrs.net.auGeneric
menuwhois.nic.menuGeneric
mgMadagascarwhois.nic.mgCountry Code
miamiwhois-dub.mm-registry.comGeneric
miniwhois.ksregistry.netGeneric
mkThe Former Yugoslav Republic Of Macedoniawhois.marnet.mkCountry Code
mlMaliwhois.dot.mlCountry Code
mnMongoliawhois.nic.mnCountry Code
moMacaowhois.monic.moCountry Code
mobiwhois.dotmobiregistry.netGeneric
modawhois.unitedtld.comGeneric
monashwhois.nic.monashGeneric
mortgagewhois.rightside.coGeneric
moscowwhois.nic.moscowGeneric
motorcycleswhois.afilias-srs.netGeneric
mpNorthern Mariana Islandswhois.nic.mpCountry Code
msMontserratwhois.nic.msCountry Code
muMauritiuswhois.nic.muCountry Code
museumwhois.museumSponsored
mxMexicowhois.mxCountry Code
myMalaysiawhois.mynic.myCountry Code
naNamibiawhois.na-nic.com.naCountry Code
namewhois.nic.nameGeneric Restricted
navywhois.rightside.coGeneric
ncNew Caledoniawhois.ncCountry Code
netwhois.verisign-grs.comGeneric
nfNorfolk Islandwhois.nic.nfCountry Code
ngNigeriawhois.nic.net.ngCountry Code
ngowhois.publicinterestregistry.netGeneric
ninjawhois.unitedtld.comGeneric
nlThe Netherlandswhois.domain-registry.nlCountry Code
noNorwaywhois.norid.noCountry Code
nrawhois.afilias-srs.netGeneric
nrwwhois-fe1.pdt.nrw.tango.knipp.deGeneric
nuNiuewhois.iis.nuCountry Code
nzNew Zealandwhois.srs.net.nzCountry Code
omOmanwhois.registry.omCountry Code
onlwhois.afilias-srs.netGeneric
orgwhois.pir.orgGeneric
organicwhois.afilias.netGeneric
ovhwhois-ovh.nic.frGeneric
pariswhois-paris.nic.frGeneric
partnerswhois.donuts.coGeneric
partswhois.donuts.coGeneric
pePerukero.yachay.peCountry Code
pfFrench Polynesiawhois.registry.pfCountry Code
photowhois.uniregistry.netGeneric
photographywhois.donuts.coGeneric
photoswhois.donuts.coGeneric
physiowhois.nic.physioGeneric
picswhois.uniregistry.netGeneric
pictureswhois.donuts.coGeneric
pinkwhois.afilias.netGeneric
plPolandwhois.dns.plCountry Code
placewhois.donuts.coGeneric
plumbingwhois.donuts.coGeneric
pmSaint Pierre and Miquelonwhois.nic.pmCountry Code
postwhois.dotpostregistry.netSponsored
prPuerto Ricowhois.nic.prCountry Code
presswhois.centralnic.comGeneric
prowhois.dotproregistry.netGeneric-restricted
productionswhois.donuts.coGeneric
propertieswhois.donuts.coGeneric
ptPortugalwhois.dns.ptCountry Code
pubwhois.unitedtld.comGeneric
pwPalauwhois.nic.pwCountry Code
qaQatarwhois.registry.qaCountry Code
quebecwhois.quebec.rs.corenic.netGeneric
reRéunionwhois.nic.reCountry Code
recipeswhois.donuts.coGeneric
redwhois.afilias.netGeneric
rehabwhois.rightside.coGeneric
reisewhois.nic.reiseGeneric
reisenwhois.donuts.coGeneric
rentalswhois.donuts.coGeneric
repairwhois.donuts.coGeneric
reportwhois.donuts.coGeneric
republicanwhois.rightside.coGeneric
restwhois.centralnic.comGeneric
reviewwhois.unitedtld.comGeneric
richwhois.afilias-srs.netGeneric
riowhois.gtlds.nic.brGeneric
roRomaniawhois.rotld.roCountry Code
rockswhois.unitedtld.comGeneric
rodeowhois-dub.mm-registry.comGeneric
rsSerbiawhois.rnids.rsCountry Code
ruRussian Federationwhois.tcinet.ruCountry Code
ruhrwhois.nic.ruhrGeneric
saSaudi Arabiawhois.nic.net.saCountry Code
saarlandwhois.ksregistry.netGeneric
sbSolomon Islandswhois.nic.net.sbCountry Code
scSeychelleswhois2.afilias-grs.netCountry Code
scbwhois.nic.scbGeneric
schmidtwhois.nic.schmidtGeneric
schulewhois.donuts.coGeneric
scotwhois.scot.coreregistry.netGeneric
seSwedenwhois.iis.seCountry Code
serviceswhois.donuts.coGeneric
sexywhois.uniregistry.netGeneric
sgSingaporewhois.sgnic.sgCountry Code
shAscension And Tristan Da Cunha Saint Helenawhois.nic.shCountry Code
shikshawhois.afilias.netGeneric
shoeswhois.donuts.coGeneric
siSloveniawhois.arnes.siCountry Code
singleswhois.donuts.coGeneric
skSlovakiawhois.sk-nic.skCountry Code
smSan Marinowhois.nic.smCountry Code
snSenegalwhois.nic.snCountry Code
soSomaliawhois.nic.soCountry Code
socialwhois.unitedtld.comGeneric
softwarewhois.rightside.coGeneric
solarwhois.donuts.coGeneric
solutionswhois.donuts.coGeneric
soydomain-registry-whois.l.google.comGeneric
spacewhois.nic.spaceGeneric
spiegelwhois.ksregistry.netGeneric
stSao Tome And Principewhois.nic.stCountry Code
suSoviet Unionwhois.tcinet.ruCountry Code
supplieswhois.donuts.coGeneric
supplywhois.donuts.coGeneric
supportwhois.donuts.coGeneric
surfwhois-dub.mm-registry.comGeneric
surgerywhois.donuts.coGeneric
sxSint Maartenwhois.sxCountry Code
sySyrian Arab Republicwhois.tld.syCountry Code
systemswhois.donuts.coGeneric
tattoowhois.uniregistry.netGeneric
taxwhois.donuts.coGeneric
tcTurks And Caicos Islandswhois.meridiantld.netCountry Code
technologywhois.donuts.coGeneric
telwhois.nic.telSponsored
tfFrench Southern and Antarctic Landswhois.nic.tfCountry Code
thThailandwhois.thnic.co.thCountry Code
tiendawhois.donuts.coGeneric
tipswhois.donuts.coGeneric
tirolwhois.nic.tirolGeneric
tkTokelauwhois.dot.tkCountry Code
tlTimor-lestewhois.nic.tlCountry Code
tmTurkmenistanwhois.nic.tmCountry Code
tnTunisiawhois.ati.tnCountry Code
toTongawhois.tonic.toCountry Code
todaywhois.donuts.coGeneric
toolswhois.donuts.coGeneric
topwhois.nic.topGeneric
townwhois.donuts.coGeneric
toyswhois.donuts.coGeneric
trTurkeywhois.nic.trCountry Code
trainingwhois.donuts.coGeneric
travelwhois.nic.travelSponsored
tvTuvalutvwhois.verisign-grs.comCountry Code
twTaiwanwhois.twnic.net.twCountry Code
tzUnited Republic Of Tanzaniawhois.tznic.or.tzCountry Code
uaUkrainewhois.uaCountry Code
ugUgandawhois.co.ugCountry Code
ukUnited Kingdomwhois.nic.ukCountry Code
universitywhois.donuts.coGeneric
usUnited States of Americawhois.nic.usCountry Code
uyUruguaywhois.nic.org.uyCountry Code
uzUzbekistanwhois.cctld.uzCountry Code
vacationswhois.donuts.coGeneric
vcSaint Vincent And The Grenadineswhois2.afilias-grs.netCountry Code
veBolivarian Republic Of Venezuelawhois.nic.veCountry Code
vegaswhois.afilias-srs.netGeneric
ventureswhois.donuts.coGeneric
versicherungwhois.nic.versicherungGeneric
vetwhois.rightside.coGeneric
vgBritish Virgin Islandsccwhois.ksregistry.netCountry Code
viajeswhois.donuts.coGeneric
villaswhois.donuts.coGeneric
visionwhois.donuts.coGeneric
vlaanderenwhois.nic.vlaanderenGeneric
vodkawhois-dub.mm-registry.comGeneric
votewhois.afilias.netGeneric
votingwhois.voting.tld-box.atGeneric
votowhois.afilias.netGeneric
voyagewhois.donuts.coGeneric
vuVanuatuvunic.vuCountry Code
waleswhois.nic.walesGeneric
wangwhois.gtld.knet.cnGeneric
watchwhois.donuts.coGeneric
websitewhois.nic.websiteGeneric
wedwhois.nic.wedGeneric
wfWallis and Futuna Islandswhois.nic.wfCountry Code
wienwhois.nic.wienGeneric
wikiwhois.nic.wikiGeneric
workswhois.donuts.coGeneric
wsSamoawhois.website.wsCountry Code
wtcwhois.nic.wtcGeneric
wtfwhois.donuts.coGeneric
xxxwhois.nic.xxxSponsored
xyzwhois.nic.xyzGeneric
yachtswhois.afilias-srs.netGeneric
ytMayottewhois.nic.ytCountry Code
zmZambiawhois.nic.zmCountry Code
zonewhois.donuts.coGeneric

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 it’s possible to check domain names for all TLDs 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 detailed information about domain names checked via the multi whois list file.