WHOIS잚돨錦맣경
2018-09-07 12:57
1、숌뺏죄덜쯤。(페茄앎角혼딜죄寧硅痰꼇淪돨긴좆돨땍屢)
2、濾뚤닖INTERNIC쇱乞돕돨斤口법黨숌데,몽앴INTERNIC럽웩돨斤口櫓돨WHOIS SERVER쏵契쏵寧꼍꿴璂。궐흔,YAHOO瞳鞠龜況尉링켕턴⇒?
class whois {
var $use_cache = 1;
var $FROM_CACHE=0;
var $cache_dir = "./"; // 몽앴콱돨溝固菱성?阮?
var $port = 43;
var $MAXLEN = 100;
// 흔벎콱拳瞳젯쌈呵겨빈菱땡路桿,
// ?阮최襪都狂?$MAX_RETRIES
var $MAX_RETRIES = 0;
var $SLEEP_VAL = 1;
var $RETRY = 0;
var $FOUND = 0; // 꿴璂청唐써벎,늴令槨0
var $ERROR = 0; // 꿴璂법넋櫓돨놔댄늴鑒
var $DATA_MIN = 8; // 乖쳬逞?夢┯청宙?몸俚쌘돨鑒앴
var $DATA_COUNT = 0;
var $WHOIS_SERVER;
var $NEW_WHOIS;
var $FURTHER_INFO = 0;
// 댔역뵨WHOIS SERVER돨SOCKET젯쌈
// 칵훰돨角ernic.net
function connect ($server) {
$this->RETRY=0;
while($this->RETRY <= $this->MAX_RETRIES):
$ptr = fsockopen($server, $this->port);
if($ptr>0):
$this->ERROR=0; // just in case were on a retry
return($ptr);
else:
$this->ERROR++;
$this->RETRY++;
sleep($this->SLEEP_VAL);
endif;
endwhile;
}
// 삿혤숌데돨꿴璂써벎,깻鹿契槨데貫,렴흙鑒莉
// 벌셥堵츰꿴璂
function rawlookup ($query, $server) {
if(!$query):
return( "");
endif;
$ptr=$this->connect($server);
if($ptr):
if(!ereg($query, "n$")):
$query .= "n";
endif;
fputs($ptr, "$query");
$i=0;
$this->FOUND=1;
while(!feof($ptr)):
$array[$i]=fgets($ptr,$this->MAXLEN);
$this->DATA_COUNT+=strlen(chop($array[$i]));
if(eregi( "No match for", $array[$i]) eregi ("No entries found", $array[$i])):
$this->FOUND=0;
elseif(eregi( "WHOIS database is down",$array[$i])):
$this->ERROR++;
$this->FOUND=0;
elseif(eregi( "Please wait a while and try again",$array[$i])):
$this->ERROR++;
$this->FOUND=0;
break;
endif;
if(eregi("Whois Server:",$array[$i])):
$this->NEW_WHOIS=trim(substr(trim($array[$i]),(strlen(trim($array[$i]))-13)*(-1)));
$this->FURTHER_INFO=1;
endif;
$i++;
endwhile;
fclose($ptr);
if($this->DATA_COUNT>$this->DATA_MIN):
return($array);
else:
$this->ERROR++;
endif;
else:
$this->ERROR++;
endif;
}
// 벌코堵츰꿴璂
function cnrawlookup ($query, $server) {
if(!$query):
return( "");
endif;
$ptr=$this->connect($server);
if($ptr):
if(!ereg($query, "n$")):
$query .= "n";
endif;
fputs($ptr, "$query");
$i=0;
$this->FOUND=1;
while(!feof($ptr)):
$array[$i]=fgets($ptr,$this->MAXLEN);
$this->DATA_COUNT+=strlen(chop($array[$i]));
if(eregi( "No match for", $array[$i]) eregi ("No entries found", $array[$i])):
$this->FOUND=0;
elseif(eregi( "WHOIS database is down",$array[$i])):
$this->ERROR++;
$this->FOUND=0;
elseif(eregi( "Please wait a while and try again",$array[$i])):
$this->ERROR++;
$this->FOUND=0;
break;
endif;
$i++;
endwhile;
fclose($ptr);
if($this->DATA_COUNT>$this->DATA_MIN):
return($array);
else:
$this->ERROR++;
endif;
else:
$this->ERROR++;
endif;
}
};
$myWHOIS=new whois();
$thisname=$servername.$domainname;
// 몽앴벌코堵츰샀벌셥堵츰朞嶝WHOIS SERVER
{
$array=$myWHOIS->cnrawlookup($thisname,$myWHOIS->WHOIS_SERVER);
}
else
{
$myWHOIS->WHOIS_SERVER="whois.internic.net";
$array=$myWHOIS->rawlookup($thisname,$myWHOIS->WHOIS_SERVER);
}
echo "
".$thisname."
";
echo "";
$x=0;
while ($x {
echo " $x ";
echo " $array[$x] ";
$x++;
}
echo "
";
if (!ereg(".cn$",$thisname))
{
echo "
Furth infomation
";
$array_further=$myWHOIS->rawlookup($thisname,$myWHOIS->NEW_WHOIS);
echo "";
$x=0;
while ($x {
echo " $x ";
echo " $array_further[$x] ";
$x++;
}
echo "
";
}
?>