-
Notifications
You must be signed in to change notification settings - Fork 0
/
CheckDomainAvailability.inc.php
85 lines (79 loc) · 2.13 KB
/
CheckDomainAvailability.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
//
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WIthOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Klavs Klavsen <[email protected]>.
//loading PHPwhois class. Only tested with v3.0.5.
include("main.whois");
class CheckDomainAvailability
{
var $mDomain; //domain looked up
var $mResult; //contains the result of the lookup done in the constructor
function CheckDomainAvailability($domain)
{
//do the whois lookup
//
//Should do eregi check for valid string
//(ie. a-zA-Z0-9.(com/net/org/info/biz/dk))
//
$whois = new Whois("$domain");
$this->mDomain = $domain;
$this->mResult = $whois->Lookup();
}
//
// check for availabilty and return true for available and false for taken.
//
function CheckIfAvailable()
{
//explode - to get the tld
$tld = explode(".", $this->mDomain);
// checking for .com .net .org domain availability
if ($argv[2] == "com" || $argv[2] == "net" || $argv[2] == "org" )
{
if(empty($this->mResult["regyinfo"]))
{
return true;
} else
{
return false;
}
// checking for .info or .biz availability
} else if ($argv[2] == "info" || $argv[2] == "biz")
{
if(empty($this->mResult["regrinfo"]))
{
return true;
} else
{
return false;
}
} else
{
$tmparray = preg_grep("/No entries found/", $this->mResult['rawdata']);
if($tmparray)
{
return true;
} else
{
return false;
}
}
//if we ended here something went wrong
//best to say it's taken :)
return false;
}
//end class
}
?>