当前位置:首页> PHP教程> PHP代码
关键字
文章内容
检测域名是否被注册的程序
 
 
修改时间:[2011/09/21 04:39]    阅读次数:[1161]    发表者:[起缘]
 
<?PHP

if ($domain)

{

if ($domain)

{

// first get the domain server from internic



$fp = fsockopen( "rs.internic.net", 43, &$errno, &$errstr, 10);

if (!$fp)

{

echo "$errstr ($errno)

n";

}

else

{

fputs($fp, "$domainrn");

while(!feof($fp))

{

$buf = fgets($fp,128);

if (ereg( "Whois Server:", $buf))

{

$server = str_replace( "Whois Server: ", "", $buf);

$server = trim($server);

}

}

fclose($fp);

}

if ($server)

{

echo "<B>很遗憾,$domain 在 $server 被注册:</B> <p>

下面是详细注册信息:<BR>";

echo "<PRE>";

$fp = fsockopen($server, 43, &$errno, &$errstr, 10);

if(!$fp)

{

echo "Could not open connection to $server on port 43.n";

echo "$errstr ($errno)

n";

}

else

{

fputs($fp, "$domainrn");

while(!feof($fp))

{

echo fgets($fp,128);

}

fclose($fp);

}

}

else {

echo( "<b>祝贺你!$domain 在 $now(time)

这一刻还没被注册,国际域名正在以5秒每个的速度减少,请在齐鲁热线注册。</b><BR>");

}

echo ( "</PRE><BR>");

}



}

?>

<FORM ACTION=" <?PHP echo($PHP_SELF); ?>" METHOD="post">

检索你要注册的域名
看是否被注册 <i>yourname</i>.com, .org, and .net domains



domain
:www. <INPUT TYPE="text" NAME="domain" SIZE="40" MAXLENGTH="100">

<INPUT TYPE=submit VALUE="Find out"><INPUT TYPE=reset VALUE="Reset">

</FORM>