加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP--用万网的接口实现域名查询功能

发布时间:2020-12-13 06:12:38 所属栏目:PHP教程 来源:网络整理
导读:今天给别人做网站时有个需求是要有域名查询功能,查了点资料写了个简单的查询功能 前台页面用的是checkbox,代码如下: div class="codetitle" a style="CURSOR: pointer" data="87011" class="copybut" id="copybut87011" onclick="doCopy('code87011')" 代
<tr>
<td align="right" valign="middle" width="251">
<p align="center">
<img border="0" src="./templates/img/www.gif"><input name="dns" type="text" id="dns" size="20" style="background-color: #C0C0C0">

</td>
<td style="padding-top:11px;" valign="top" width="99">

<input type="submit" value="查询"/>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" style="padding-left:12px;">
<table width="96%" border="0" cellspacing="0" cellpadding="0" height="94%">
<tr>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="com" checked="">.com</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="cn" checked="">.cn</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="tel" checked="">.tel</td>
</tr>
<tr>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="mobi">.mobi</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="net" checked="">.net</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="org">.org</td>
</tr>
<tr>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="asia">.asia</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="me">.me</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="com.cn" checked="">.com.cn</td>
</tr>
<tr>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="net.cn">.net.cn</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="org.cn">.org.cn</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="gov.cn">.gov.cn</td>
</tr>
<tr>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="hk">.hk</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="tv">.tv</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="biz">.biz</td>
</tr>
<tr>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="cc">.cc</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="name">.name</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="info">.info</td>
</tr>
<tr>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="公司">.公司</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="网络">.网络</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="中国">.中国</td>
</tr>
</table></td>
</tr>


PHP代码:
<div class="codetitle"><a style="CURSOR: pointer" data="78725" class="copybut" id="copybut78725" onclick="doCopy('code78725')"> 代码如下:<div class="codebody" id="code78725">
<?php //得到顶级域名
$ext=$_POST['ext'];
//得到二级域名
$dns = $_POST['dns']; //print_r($ext);
//$domain = $dns . "." . $ext[0];
//echo $domain; //遍历所有的域名
foreach ($ext as $value) {
//组合域名
$domain = $dns . "." . $value; //查询:
echo $domain ; $do = "http://panda.www.net.cn/cgi-bin/check.cgi?area_domain=" . $domain;
$xml_data = file_get_contents($do);
$result_arr = (array) simplexml_load_string($xml_data); $returncode=$result_arr['returncode'];
$key=$result_arr['key']; $original=$result_arr['original']; $status= substr($original,3); if($status=="210"){ echo ":恭喜您,可以注册"; }else if($status=="211"){ echo ":已经注册"; }else if($status=="212"){ echo ":参数错误"; }
echo '
'; } ?>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

今天给别人做网站时有个需求是要有域名查询功能,查了点资料写了个简单的查询功能
前台页面用的是checkbox,代码如下:
<div class="codetitle"><a style="CURSOR: pointer" data="87011" class="copybut" id="copybut87011" onclick="doCopy('code87011')"> 代码如下:<div class="codebody" id="code87011">
<form name="form1" method="post" action="chaxun.php">

    推荐文章
      热点阅读