PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / trunk
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits vtrunk
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / inc / classes / domain-checker.php

domain-checker.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits trunk, at inc/classes/domain-checker.php

491 lines 32.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MasterAddons\Inc\Classes;
4
5 /**
6 * Class responsible for checking if a domain is registered
7 *
8 *
9 * @param boolean $error_reporting Set if the function should display errors or suppress them, default is false
10 * @return boolean true means the domain is NOT registered
11 */
12 class Domain_Checker
13 {
14
15 private $error_reporting;
16
17 public function __construct($debug = false)
18 {
19
20 if ($debug) {
21 $error_reporting = true;
22 } else {
23 $error_reporting = false;
24 }
25 }
26
27
28 public function is_available($domain)
29 {
30
31 // make the domain lowercase
32 $domain = strtolower($domain);
33
34 // Set the timeout (in seconds) for the socket open function.
35 $timeout = 10;
36
37
38
39 /**
40 * This array contains the list of WHOIS servers and the "domain not found" string
41 * to be searched for to check if the domain is available for registration.
42 *
43 * NOTE: The "domain not found" string may change at any time for any reason.
44 */
45 $whois_arr = array(
46 "com" => array("whois.verisign-grs.com", "No match for"),
47 "net" => array("whois.verisign-grs.com", "No match for "),
48 "org" => array("whois.pir.org", "NOT FOUND"),
49 "co.uk" => array("whois.nic.uk", "No match for "),
50 "io" => array("whois.nic.io", "is available for purchase"),
51 "computer" => array("whois.donuts.co", "Domain not found."),
52 "ac" => array("whois.nic.ac", "is available for purchase"),
53 "academy" => array("whois.donuts.co", "Domain not found."),
54 "actor" => array("whois.unitedtld.com", "Domain not found."),
55 "ae" => array("whois.aeda.net.ae", "No Data Found"),
56 "aero" => array("whois.aero", "NOT FOUND"),
57 "af" => array("whois.nic.af", "Domain Status: No Object Found"),
58 "ag" => array("whois.nic.ag", "NOT FOUND"),
59 "agency" => array("whois.donuts.co", "Domain not found."),
60 "ai" => array("whois.ai", "If you would like to register this, or any .ai domain"),
61 "am" => array("whois.amnic.net", "No match"),
62 "archi" => array("whois.ksregistry.net", "not found..."),
63 "arpa" => array("whois.iana.org", "% This query returned 0 objects."),
64 "as" => array("whois.nic.as", "Domain Status: Available"),
65 "asia" => array("whois.nic.asia", "NOT FOUND"),
66 "associates" => array("whois.donuts.co", "Domain not found."),
67 "at" => array("whois.nic.at", "% nothing found"),
68 "au" => array("whois.audns.net.au", "NOT FOUND"),
69 "aw" => array("whois.nic.aw", " is free"),
70 "ax" => array("whois.ax", "No records matching "),
71 "az" => array("whois.az", "MATCH"), // not responding
72 "bar" => array("whois.nic.bar", "DOMAIN NOT FOUND"),
73 "bargains" => array("whois.donuts.co", "Domain not found."),
74 "be" => array("whois.dns.be", "Status: AVAILABLE"),
75 "berlin" => array("whois.nic.berlin", "% No match"),
76 "bg" => array("whois.register.bg", "does not exist in database!"),
77 "bi" => array("whois1.nic.bi", "Domain Status: No Object Found"),
78 "bike" => array("whois.donuts.co", "Domain not found."),
79 "biz" => array("whois.biz", "Not found: "),
80 "bj" => array("whois.nic.bj", "No records matching"),
81 "blackfriday" => array("whois.uniregistry.net", "is available for"),
82 "bn" => array("whois.bn", "No records matching"),
83 "boutique" => array("whois.donuts.co", "Domain not found."),
84 "build" => array("whois.nic.build", "No Data Found"),
85 "builders" => array("whois.donuts.co", "Domain not found."),
86 "bw" => array("whois.nic.net.bw", "Domain Status: No Object Found"),
87 "by" => array("whois.cctld.by", "Object does not exist"),
88 "ca" => array("whois.cira.ca", "Domain status: available"),
89 "cab" => array("whois.donuts.co", "Domain not found."),
90 "camera" => array("whois.donuts.co", "Domain not found."),
91 "camp" => array("whois.donuts.co", "Domain not found."),
92 "captial" => array("whois.donuts.co", "Domain not found."),
93 "cards" => array("whois.donuts.co", "Domain not found."),
94 "careers" => array("whois.donuts.co", "Domain not found."),
95 "cat" => array("whois.cat", "NOT FOUND."),
96 "catering" => array("whois.donuts.co", "Domain not found."),
97 "cc" => array("ccwhois.verisign-grs.com", "No match for"),
98 "center" => array("whois.donuts.co", "Domain not found."),
99 "ceo" => array("whois.nic.ceo", "Not found:"),
100 "cf" => array("whois.dot.cf", "Invalid query or domain name not known in Dot CF Domain Registry"),
101 "ch" => array("whois.nic.ch", "We do not have an entry in our database matching your query."),
102 "cheap" => array("whois.donuts.co", "Domain not found."),
103 "christmas" => array("whois.uniregistry.net", "is available for registration"),
104 "ci" => array("whois.nic.ci", "not found"),
105 "cl" => array("whois.nic.cl", ": no existe"),
106 "cleaning" => array("whois.donuts.co", "Domain not found."),
107 "clothing" => array("whois.donuts.co", "Domain not found."),
108 "club" => array("whois.nic.club", "Not found:"),
109 "cn" => array("whois.cnnic.cn", "no matching record."),
110 "co" => array("whois.nic.co", "Not found:"),
111 "codes" => array("whois.donuts.co", "Domain not found."),
112 "coffee" => array("whois.donuts.co", "Domain not found."),
113 "college" => array("whois.centralnic.com", "DOMAIN NOT FOUND"),
114 "cologne" => array("whois-fe1.pdt.cologne.tango.knipp.de", "no matching objects found"),
115 "community" => array("whois.donuts.co", "Domain not found."),
116 "company" => array("whois.donuts.co", "Domain not found."),
117 "construction" => array("whois.donuts.co", "Domain not found."),
118 "contractors" => array("whois.donuts.co", "Domain not found."),
119 "cooking" => array("whois-dub.mm-registry.com", "Status: Not Registered"),
120 "cool" => array("whois.donuts.co", "Domain not found."),
121 "coop" => array("whois.nic.coop", "No domain records were found to match"),
122 "country" => array("whois-dub.mm-registry.com", "Status: Not Registered"),
123 "cruises" => array("whois.donuts.co", "Domain not found."),
124 "cx" => array("whois.nic.cx", "Domain Status: No Object Found"),
125 "cz" => array("whois.nic.cz", "No entries found."),
126 "dating" => array("whois.donuts.co", "Domain not found."),
127 "de" => array("whois.denic.de", "Status: free"),
128 "democrat" => array("whois.unitedtld.com", "Domain not found."),
129 "desi" => array("whois.ksregistry.net", "not found..."),
130 "diamonds" => array("whois.donuts.co", "Domain not found."),
131 "directory" => array("whois.donuts.co", "Domain not found."),
132 "dk" => array("whois.dk-hostmaster.dk", "No entries found for the selected source."),
133 "dm" => array("whois.nic.dm", "not found..."),
134 "domains" => array("whois.donuts.co", "Domain not found."),
135 "dz" => array("whois.nic.dz", "NO OBJECT FOUND!"),
136 "ec" => array("whois.nic.ec", "Status: Not Registered"),
137 "edu" => array("whois.educause.edu", "No Match"),
138 "education" => array("whois.donuts.co", "Domain not found."),
139 "ee" => array("whois.tld.ee", "No entries found."),
140 "email" => array("whois.donuts.co", "Domain not found."),
141 "engineering" => array("whois.donuts.co", "Domain not found."),
142 "enterprises" => array("whois.donuts.co", "Domain not found."),
143 "equipment" => array("whois.donuts.co", "Domain not found."),
144 //"es" => array("whois.nic.es","MATCH"), // You need your IP to be whitelisted, read more: https://sede.red.gob.es/eRegistro/inicio.action
145 "estate" => array("whois.donuts.co", "Domain not found."),
146 "eu" => array("whois.eu", "Status: AVAILABLE"),
147 "eus" => array("whois.eus.coreregistry.net", "no matching objects found"),
148 "events" => array("whois.donuts.co", "Domain not found."),
149 "expert" => array("whois.donuts.co", "Domain not found."),
150 "exposed" => array("whois.donuts.co", "Domain not found."),
151 "farm" => array("whois.donuts.co", "Domain not found."),
152 "feedback" => array("whois.centralnic.com", "DOMAIN NOT FOUND"),
153 "fi" => array("whois.fi", "Domain not found"),
154 "fish" => array("whois.donuts.co", "Domain not found."),
155 "fishing" => array("whois-dub.mm-registry.com", "Status: Not Registered"),
156 "flights" => array("whois.donuts.co", "Domain not found."),
157 "florist" => array("whois.donuts.co", "Domain not found."),
158 "fo" => array("whois.nic.fo", "No entries found."),
159 "foo" => array("domain-registry-whois.l.google.com", "Domain not found"),
160 "foundation" => array("whois.donuts.co", "Domain not found."),
161 "fr" => array("whois.nic.fr", "No entries found"),
162 "frogans" => array("whois-frogans.nic.fr", "Requested Domain cannot be found"),
163 "futbol" => array("whois.unitedtld.com", "Domain not found."),
164 "ga" => array("whois.gal.coreregistry.net", "no matching objects found"),
165 "gal" => array("whois.donuts.co", "Domain not found."),
166 "gd" => array("whois.nic.gd", "not found..."),
167 "gg" => array("whois.gg", "Domain Status: No Object Found"),
168 "gi" => array("whois2.afilias-grs.net", "NOT FOUND"),
169 "gift" => array("whois.uniregistry.net", "is available for registration"),
170 "gl" => array("whois.nic.gl", "Domain Status: No Object Found"),
171 "glass" => array("whois.donuts.co", "Domain not found."),
172 "gop" => array("whois-cl01.mm-registry.com", "Status: Not Registered"),
173 "gov" => array("whois.nic.gov", "No match for"),
174 "graphics" => array("whois.donuts.co", "Domain not found."),
175 "gripe" => array("whois.donuts.co", "Domain not found."),
176 "gs" => array("whois.nic.gs", "Domain Status: No Object Found"),
177 "guitars" => array("whois.uniregistry.net", "is available for registration"),
178 "guru" => array("whois.donuts.co", "Domain not found."),
179 "gy" => array("whois.registry.gy", "Domain Status: No Object Found"),
180 "haus" => array("whois.unitedtld.com", "Domain not found."),
181 "hk" => array("whois.hkirc.hk", "The domain has not been registered."),
182 "hn" => array("whois.nic.hn", "Domain Status: No Object Found"),
183 "holiday" => array("whois.donuts.co", "Domain not found."),
184 "horse" => array("whois-dub.mm-registry.com", "Status: Not Registered"),
185 "house" => array("whois.donuts.co", "Domain not found."),
186 "hr" => array("whois.dns.hr", "ERROR: no entries found"),
187 "ht" => array("whois.nic.ht", "Domain Status: No Object Found"),
188 "hu" => array("whois.nic.hu", "No match"),
189 "id" => array("whois.pandi.or.id", "DOMAIN NOT FOUND"),
190 "ie" => array("whois.domainregistry.ie", "Not Registered"),
191 "il" => array("whois.isoc.org.il", "No data was found to match the request criteria."),
192 "im" => array("whois.nic.im", "was not found."),
193 "immobilien" => array("whois.unitedtld.com", "Domain not found."),
194 "in" => array("whois.inregistry.net", "NOT FOUND"),
195 "industries" => array("whois.donuts.co", "Domain not found."),
196 "institute" => array("whois.donuts.co", "Domain not found."),
197 "int" => array("whois.iana.org", "This query returned 0 objects."),
198 "international" => array("whois.donuts.co", "Domain not found."),
199 "iq" => array("whois.cmc.iq", "Domain Status: No Object Found"),
200 "ir" => array("whois.nic.ir", "No entries found in the selected"),
201 "is" => array("whois.isnic.is", "No entries found for query"),
202 "it" => array("whois.nic.it", "Status: AVAILABLE"),
203 "je" => array("whois.je", "Domain Status: No Object Found"),
204 "jobs" => array("jobswhois.verisign-grs.com", "No match for"),
205 "jp" => array("whois.jprs.jp", "No match!!"),
206 "kaufen" => array("whois.unitedtld.com", "Domain not found."),
207 "ke" => array("whois.kenic.or.ke", "Status: Not Registered"),
208 "kg" => array("whois.domain.kg", "Data not found. This domain is available for registration."),
209 "ki" => array("whois.nic.ki", "Domain Status: No Object Found"),
210 "kitchen" => array("whois.donuts.co", "Domain not found."),
211 "kiwi" => array("whois.dot-kiwi.com", "Status: Not Registered"),
212 "koeln" => array("whois-fe1.pdt.koeln.tango.knipp.de", "no matching objects found"),
213 "kr" => array("whois.kr", "Above domain name is not registered to KRNIC."),
214 "kz" => array("whois.nic.kz", "Nothing found for this query."),
215 "la" => array("whois.nic.la", "DOMAIN NOT FOUND"),
216 "land" => array("whois.donuts.co", "Domain not found."),
217 "lease" => array("whois.donuts.co", "Domain not found."),
218 "li" => array("whois.nic.li", "We do not have an entry in our database matching your query"),
219 "lighting" => array("whois.donuts.co", "Domain not found."),
220 "limo" => array("whois.donuts.co", "Domain not found."),
221 "link" => array("whois.uniregistry.net", "is available for registration"),
222 "london" => array("whois-lon.mm-registry.com", "Status: Not Registered"),
223 "lt" => array("whois.domreg.lt", "Status: available"),
224 "lu" => array("whois.dns.lu", "No such domain"),
225 "luxury" => array("whois.nic.luxury", "No Data Found"),
226 "lv" => array("whois.nic.lv", "Status: free"),
227 "ly" => array("whois.nic.ly", "Not found"),
228 "ma" => array("whois.iam.net.ma", "No Objects Found"),
229 "management" => array("whois.donuts.co", "Domain not found."),
230 "mango" => array("whois.mango.coreregistry.net", "no matching objects found"),
231 "marketing" => array("whois.donuts.co", "Domain not found."),
232 "md" => array("whois.nic.md", "No match for"),
233 "me" => array("whois.nic.me", "NOT FOUND"),
234 "media" => array("whois.donuts.co", "Domain not found."),
235 "menu" => array("whois.nic.menu", "No Data Found"),
236 "mg" => array("whois.nic.mg", "Domain Status: Available"),
237 "miami" => array("whois-dub.mm-registry.com", "Status: Not Registered"),
238 "mk" => array("whois.marnet.mk", "no entries found"),
239 "ml" => array("whois.dot.ml", "domain name not known"),
240 "mn" => array("whois.nic.mn", "MATCH"), // not responding
241 "mo" => array("whois.monic.mo", "No match for"),
242 "mobi" => array("whois.dotmobiregistry.net", "NOT FOUND"),
243 "moda" => array("whois.unitedtld.com", "Domain not found."),
244 "monash" => array("whois.nic.monash", "No Data Found"),
245 "mp" => array("whois.nic.mp", "MATCH"), // not responding
246 "ms" => array("whois.nic.ms", "Domain Status: No Object Found"),
247 "mu" => array("whois.nic.mu", "Domain Status: No Object Found"),
248 "museum" => array("whois.museum", "NOT FOUND."),
249 "mx" => array("whois.mx", "Object_Not_Found"),
250 "my" => array("whois.domainregistry.my", "does not exist in database"),
251 "na" => array("whois.na-nic.com.na", "Domain Status: No Object Found"),
252 "name" => array("whois.nic.name", "No match for"),
253 "nc" => array("whois.nc", "No entries found in the .nc database"),
254 "nf" => array("whois.nic.nf", "Domain Status: No Object Found"),
255 "ng" => array("whois.nic.net.ng", "Domain Status: Available"),
256 "ninja" => array("whois.unitedtld.com", "Domain not found."),
257 "nl" => array("whois.domain-registry.nl", "is free"),
258 "no" => array("whois.norid.no", "% No match"),
259 "nu" => array("whois.iis.nu", "not found."),
260 "nz" => array("whois.srs.net.nz", "220 Available"),
261 "om" => array("whois.registry.om", "No Data Found"),
262 "onl" => array("whois.afilias-srs.net", "NOT FOUND"),
263 "paris" => array("whois-paris.nic.fr", "Requested Domain cannot be found"),
264 "partners" => array("whois.donuts.co", "Domain not found."),
265 "parts" => array("whois.donuts.co", "Domain not found."),
266 "pe" => array("kero.yachay.pe", "Status: Not Registered"),
267 "pf" => array("whois.registry.pf", "Domain unknown"),
268 "photo" => array("whois.uniregistry.net", "is available for registration"),
269 "photography" => array("whois.donuts.co", "Domain not found."),
270 "photos" => array("whois.donuts.co", "Domain not found."),
271 "pics" => array("whois.uniregistry.net", "is available for registration"),
272 "pictures" => array("whois.donuts.co", "Domain not found."),
273 "pl" => array("whois.dns.pl", "No information available"),
274 "plumbing" => array("whois.donuts.co", "Domain not found."),
275 "pm" => array("whois.nic.pm", "No entries found"),
276 "post" => array("whois.dotpostregistry.net", "NOT FOUND"),
277 "pr" => array("whois.nic.pr", "is not registered."),
278 "pro" => array("whois.dotproregistry.net", "NOT FOUND"),
279 "productions" => array("whois.donuts.co", "Domain not found."),
280 "properties" => array("whois.donuts.co", "Domain not found."),
281 "pt" => array("whois.dns.pt", "no match"),
282 "pub" => array("whois.unitedtld.com", "Domain not found."),
283 "pw" => array("whois.nic.pw", "DOMAIN NOT FOUND"),
284 "qa" => array("whois.registry.qa", "No Data Found"),
285 "quebec" => array("whois.quebec.rs.corenic.net", "no matching objects found"),
286 "re" => array("whois.nic.re", "No entries found"),
287 "recipes" => array("whois.donuts.co", "Domain not found."),
288 "reisen" => array("whois.donuts.co", "Domain not found."),
289 "rentals" => array("whois.donuts.co", "Domain not found."),
290 "repair" => array("whois.donuts.co", "Domain not found."),
291 "report" => array("whois.donuts.co", "Domain not found."),
292 "rest" => array("whois.centralnic.com", "DOMAIN NOT FOUND"),
293 "reviews" => array("whois.unitedtld.com", "Domain not found."),
294 "rich" => array("whois.afilias-srs.net", "NOT FOUND"),
295 "ro" => array("whois.rotld.ro", "No entries found"),
296 "rocks" => array("whois.unitedtld.com", "Domain not found."),
297 "rodeo" => array("whois-dub.mm-registry.com", "Status: Not Registered"),
298 "rs" => array("whois.rnids.rs", "Domain is not registered"),
299 "ru" => array("whois.tcinet.ru", "No entries found"),
300 "ruhr" => array("whois.nic.ruhr", "no matching objects found"),
301 "sa" => array("whois.nic.net.sa", "No Match for"),
302 "saarland" => array("whois.ksregistry.net", "not found..."),
303 "sb" => array("whois.nic.net.sb", "Domain Status: No Object Found"),
304 "sc" => array("whois2.afilias-grs.net", "NOT FOUND"),
305 "se" => array("whois.iis.se", "not found."),
306 "services" => array("whois.donuts.co", "Domain not found."),
307 "sexy" => array("whois.uniregistry.net", "is available for"),
308 "sg" => array("whois.sgnic.sg", "Domain Not Found"),
309 "sh" => array("whois.nic.sh", "is available for purchase"),
310 "shoes" => array("whois.donuts.co", "Domain not found."),
311 "si" => array("whois.arnes.si", "No entries found"),
312 "singles" => array("whois.donuts.co", "Domain not found."),
313 "sk" => array("whois.sk-nic.sk", "Not found."),
314 "sm" => array("whois.nic.sm", "No entries found."),
315 "sn" => array("whois.nic.sn", "NOT FOUND"),
316 "so" => array("whois.nic.so", "DOMAIN NOT FOUND"),
317 "social" => array("whois.unitedtld.com", "Domain not found."),
318 "solar" => array("whois.donuts.co", "Domain not found."),
319 "solutions" => array("whois.donuts.co", "Domain not found."),
320 "soy" => array("domain-registry-whois.l.google.com", "Domain not found"),
321 "st" => array("whois.nic.st", "No entries found"),
322 "su" => array("whois.tcinet.ru", "No entries found"),
323 "supplies" => array("whois.donuts.co", "Domain not found."),
324 "supply" => array("whois.donuts.co", "Domain not found."),
325 "support" => array("whois.donuts.co", "Domain not found."),
326 "sx" => array("whois.sx", "Status: AVAILABLE"),
327 "sy" => array("whois.tld.sy", "Domain Status: Available"),
328 "systems" => array("whois.donuts.co", "Domain not found."),
329 "tattoo" => array("whois.uniregistry.net", "is available for registration"),
330 "tc" => array("whois.meridiantld.net", "Domain Status: No Object Found"),
331 "technology" => array("whois.donuts.co", "Domain not found."),
332 "tel" => array("whois.nic.tel", "Not found:"),
333 "tf" => array("whois.nic.tf", "No entries found"),
334 "th" => array("whois.thnic.co.th", "No match for"),
335 "tienda" => array("whois.donuts.co", "Domain not found."),
336 "tips" => array("whois.donuts.co", "Domain not found."),
337 "tk" => array("whois.dot.tk", "Invalid query or domain name not known"),
338 "tl" => array("whois.nic.tl", "Domain Status: No Object Found"),
339 "tm" => array("whois.nic.tm", "is available for purchase"),
340 "tn" => array("whois.ati.tn", "NO OBJECT FOUND!"),
341 "to" => array("whois.tonic.to", "No match for"),
342 "today" => array("whois.donuts.co", "Domain not found."),
343 "tools" => array("whois.donuts.co", "Domain not found."),
344 "town" => array("whois.donuts.co", "Domain not found."),
345 "toys" => array("whois.donuts.co", "Domain not found."),
346 "tr" => array("whois.nic.tr", "No match found for"),
347 "training" => array("whois.donuts.co", "Domain not found."),
348 "travel" => array("whois.nic.travel", "Not found:"),
349 "tv" => array("tvwhois.verisign-grs.com", "No match for"),
350 "tw" => array("whois.twnic.net.tw", "No Found"),
351 "tz" => array("whois.tznic.or.tz", "No entries found."),
352 "ua" => array("whois.ua", "No entries found for"),
353 "ug" => array("whois.co.ug", "No entries found for the selected source(s)."),
354 "uk" => array("whois.nic.uk", "This domain name has not been registered."),
355 "university" => array("whois.donuts.co", "Domain not found."),
356 "us" => array("whois.nic.us", "Not found"),
357 "uy" => array("whois.nic.org.uy", "No match for"),
358 "black" => array("whois.afilias.net", "NOT FOUND"),
359 "blue" => array("whois.afilias.net", "NOT FOUND"),
360 "info" => array("whois.afilias.net", "NOT FOUND"),
361 "kim" => array("whois.afilias.net", "NOT FOUND"),
362 "pink" => array("whois.afilias.net", "NOT FOUND"),
363 "red" => array("whois.afilias.net", "NOT FOUND"),
364 "shiksha" => array("whois.afilias.net", "NOT FOUND"),
365 "uz" => array("whois.cctld.uz", "not found in database"),
366 "vacations" => array("whois.donuts.co", "Domain not found."),
367 "vc" => array("whois2.afilias-grs.net", "NOT FOUND"),
368 "ve" => array("whois.nic.ve", "No match for"),
369 "vegas" => array("whois.afilias-srs.net", "NOT FOUND"),
370 "ventures" => array("whois.donuts.co", "Domain not found."),
371 "vg" => array("ccwhois.ksregistry.net", "not found..."),
372 "viajes" => array("whois.donuts.co", "Domain not found."),
373 "villas" => array("whois.donuts.co", "Domain not found."),
374 "vision" => array("whois.donuts.co", "Domain not found."),
375 "vodka" => array("whois-dub.mm-registry.com", "Status: Not Registered"),
376 "voting" => array("whois.voting.tld-box.at", "No match"),
377 "voyage" => array("whois.donuts.co", "Domain not found."),
378 "vu" => array("vunic.vu", "is not valid!"),
379 "wang" => array("whois.gtld.knet.cn", "No match"),
380 "watch" => array("whois.donuts.co", "Domain not found."),
381 "wed" => array("whois.nic.wed", "Domain Status: No Object Found"),
382 "wf" => array("whois.nic.wf", "No entries found in the AFNIC Database."),
383 "wien" => array("whois.nic.wien", "No match"),
384 "wiki" => array("whois.nic.wiki", "DOMAIN NOT FOUND"),
385 "works" => array("whois.donuts.co", "Domain not found."),
386 "ws" => array("whois.website.ws", "No match for"),
387 "xxx" => array("whois.nic.xxx", "NOT FOUND"),
388 "xyz" => array("whois.nic.xyz", "DOMAIN NOT FOUND"),
389 "yt" => array("whois.nic.yt", "No entries found in the AFNIC Database."),
390 "ryukyu" => array("whois.nic.ryukyu", "DOMAIN NOT FOUND"),
391 "zm" => array("whois.nic.zm", "Domain Status: No Object Found"),
392 "zone" => array("whois.donuts.co", "Domain not found."),
393 "scot" => array("whois.nic.scot", "no matching objects found"),
394 "br" => array("whois.nic.br", "No match for"),
395 "engineer" => array("whois.nic.engineer", "Domain not found"),
396 "gifts" => array("whois.nic.gifts", "Domain not found"),
397 "quebec" => array("whois.nic.quebec", "no matching objects found"),
398 "restaurant" => array("whois.nic.restaurant", "Domain not found"),
399 "sarl" => array("whois.nic.sarl", "Domain not found"),
400 "click" => array("whois.nic.click", "is available for registration"),
401 "host" => array("whois.nic.host", "DOMAIN NOT FOUND"),
402 "hosting" => array("whois.nic.hosting", "is available for registration"),
403 "trade" => array("whois.nic.trade", "Not found"),
404 "career" => array("whois.nic.career|No match for"),
405 "diet" => array("whois.nic.diet", "is available for registration"),
406 "help" => array("whois.nic.help", "is available for registration"),
407 "jobs" => array("jobswhois.verisign-grs.com", "No match for"),
408 "property" => array("whois.nic.property", "is available for registration"),
409 "beer" => array("whois.nic.beer", "Not Registered"),
410 "direct" => array("whois.nic.direct", "Domain not found"),
411 "place" => array("whois.nic.place", "Domain not found"),
412 "surf" => array("whois.nic.surf", "Not Registered"),
413 "healthcare" => array("whois.donuts.co", "Domain not found"),
414 "army" => array("whois.unitedtld.com", "Domain not found"),
415 "navy" => array("whois.unitedtld.com", "Domain not found"),
416 "airforce" => array("whois.unitedtld.com", "Domain not found"),
417 "vet" => array("whois.unitedtld.com", "Domain not found"),
418 "za" => array("whois.co.za", "Available")
419 );
420
421
422 // gethostbyname returns the same string if it cant find the domain,
423 // we do a further check to see if it is a false positive
424 //if (gethostbyname($domain) == $domain) {
425 // get the TLD of the domain
426 $tld = $this->get_tld($domain);
427
428 // If an entry for the TLD exists in the whois array
429 if (isset($whois_arr[$tld][0])) {
430 // set the hostname for the whois server
431 $whois_server = $whois_arr[$tld][0];
432
433 // set the "domain not found" string
434 $bad_string = $whois_arr[$tld][1];
435 } else {
436 // TODO: REFACTOR THIS
437 // TLD is not in the whois array, die
438 //throw new Exception("WHOIS server not found for that TLD");
439 return '2';
440 }
441
442 $status = $this->checkDomainNameAvailabilty($domain, $whois_server, $bad_string);
443
444 return $status;
445 //} else {
446 // not available
447 // return FALSE;
448 //}
449
450 }
451
452 public function get_tld($domain)
453 {
454 $split = explode('.', $domain);
455
456 if (count($split) === 0) {
457 throw new \Exception('Invalid domain extension');
458 }
459 return end($split);
460 }
461
462 public function checkDomainNameAvailabilty($domain_name, $whois_server, $find_text)
463 {
464
465 // Open a socket connection to the whois server.
466 // phpcs:disable WordPress.WP.AlternativeFunctions -- WHOIS is a raw TCP protocol on port 43; the WP HTTP API only supports HTTP/HTTPS and cannot perform WHOIS lookups, so a direct socket is required here.
467 $con = fsockopen($whois_server, 43);
468 if (!$con) return false;
469
470 // Send the requested domain name
471 fputs($con, $domain_name . "\r\n");
472
473 // Read and store the server response
474 $response = " :";
475 while (!feof($con))
476 $response .= fgets($con, 128);
477
478 // Close the connection
479 fclose($con);
480 // phpcs:enable WordPress.WP.AlternativeFunctions
481
482 // Check the Whois server response. strpos() can return 0 (match at the
483 // very start) which is falsy, so compare against false explicitly —
484 // otherwise an available domain can be misreported as taken.
485 if (strpos(strtolower($response), strtolower($find_text)) !== false)
486 return '1';
487 else
488 return '0';
489 }
490 }
491