glebushka
Это whois червис называется.
Скрипт пишется за 15 минут.
require("../common/parse.inc");
require("whois.vars.inc");
$information = \'\';
function whois_request($server,$query)
{
Global $information;
$data = "";
$fp = fsockopen($server , 43);
if ($fp) :
fputs($fp,$query."\\r\\n");
while(!feof($fp)) {
$data .= fgets($fp,4096).\'
\';
}
$information = $data;
fclose($fp);
return $data;
else:
return \'none\';
endif;
}
function domain_tld($domain)
{
$ret = "";
if (ereg("\\.([^\\.]+)$",$domain,$answer))
{
$ret = strtolower($answer[1]);
}
return $ret;
}
function is_domain_available($domain)
{
global $whois_server;
$ret = false;
$tld = Domain_tld($domain);
if (!empty($tld) && is_array($whois_server[$tld]))
{
$data = whois_request($whois_server[$tld][0],$domain);
if(strstr($data,$whois_server[$tld][1]))
{
$ret = true;
}
}
return $ret;
}
function parse_info($info)
{
$data = \'\';
//$info = eregi_replace("\\n",\'\',$info);
//$info = eregi_replace("
",\'\',$info);
$lines = split("
\\n
",$info);
for($step = 1;$step < sizeof($lines);$step++)
{
if(strstr(\'%\',$lines[$step])):
continue;
endif;
$data .= \'
\'.$lines[$step].\'
\';
}
return $data;
} // function
$full_name = $param["domainname"].\'.\'.$param["domainzone"];
echo($domain_state[is_domain_available($full_name)]);
if(is_domain_available($full_name))
{}
else
{
echo\'
\';
echo(parse_info($information));
}
?>
whois.vars.inc
$whois_server=array(
"aero"=>array("whois.information.aero","is available"),
"com"=>array("whois.networksolutions.com","no match for"),
"org"=> array("whois.networksolutions.com","no match for"),
//"coop" => array("whois.nic.coop","o match found"),
"net" => array("whois.networksolutions.com","no match for"),
//"info" => array("whois.nic.info","not in the "),
"biz" =>array("whois.whois.biz","Not found:"),
"ac" => array("whois.nic.ac","No match for"),
"ad" => array("whois.nic.ad","No match for"),
"us" => array("whois.networksolutions.com","no match for"),
"ws" => array("whois.networksolutions.com","no match for"),
"cc" => array("whois.networksolutions.com","no match for"),
"bz" =>array("whois.networksolutions.com","no match for"),
"tv" => array("whois.networksolutions.com","no match for"),
"ms" =>array("whois.networksolutions.com","no match for"),
"vg" => array("whois.networksolutions.com","no match for"),
"nu" => array("whois.networksolutions.com","no match for"),
"gs" =>array("whois.networksolutions.com","no match for"),
"tc" => array("whois.networksolutions.com","no match for"),
"ru" => array("whois.ripn.net","Not delegated"),
"us"=>array("whois.nic.us","Not found:")
);
switch($param[lang])
{
case \'ru\':
$domain_details = array("Domain"=>"Доменное имя",
\'type\'=>\'тип\'
);
$domain_state = array(1=>"Не делегирован",0=>"Делегирован");
break;
case \'de\':
break;
default:
$domain_state = array(1=>"Not delegated",0=>"Delegated");
break;
}
?>