<?php
error_reporting(E_ALL);
function whois_api($domain,$suffix){
$params= urlencode($domain).urlencode($suffix);
$params = 'domain='.$params;
//echo $params."/n";
$url = "http://218.30.103.77/cgi-bin/check_muitl.cgi?".$params;
//echo $url."/n";
$result=file($url);
$status = explode('|',$result[0]);
$str = $status[2];
$name = $status[1];
//-1 查询失败
//0 不可注册
//1 可以注册
if ($str == '210' ){
return 1;
}elseif ($str == '211' ) {
return 0;
}elseif ($str =='212'){
return -1;
}else{
return -1;
}
}
if(isset($_POST['domain'])) {
$domain=$_POST['domain'];
$r=whois_api($domain,'.com');
if($r==1) echo $domain.'.com <font color=red siz="+3">可以注册</font><br>';
elseif($r==0) echo $domain.'.com 已经注册<br>';
else echo $domain.'.com 查询失败<br>';
$r=whois_api($domain,'.cn');
if($r==1) echo $domain.'.cn <font color=red siz="+3">可以注册</font><br>';
elseif($r==0) echo $domain.'.cn 已经注册<br>';
else echo $domain.'.cn 查询失败<br>';
$r=whois_api($domain,'.net');
if($r==1) echo $domain.'.net <font color=red siz="+3">可以注册</font><br>';
elseif($r==0) echo $domain.'.net 已经注册<br>';
else echo $domain.'.net 查询失败<br>';
}
?>
<html>
<head>
<title>dns</title>
</head>
<body οnlοad="javascript:document.form1.domain.focus();">
<form name="form1" action="index.php" method="post">
<input name="domain" type="text" value="" >
<input name="submit" type="submit" value="查询">
</form>
</body>
</html>