PHP--用萬(wàn)網(wǎng)的接口實(shí)現(xiàn)域名查詢功能
前臺(tái)頁(yè)面用的是checkbox,代碼如下:
<form name="form1" method="post" action="chaxun.php">
<tbody><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"></p></td>
<td style="padding-top:11px;" valign="top" width="99">
<!--
<input type="image" src="./templates/img/cx.gif" align="left" onclick="submit()" width="50" height="18">
-->
<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%">
<tbody><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="網(wǎng)絡(luò)">.網(wǎng)絡(luò)</td>
<td align="left" width="76"><input name="ext[]" type="checkbox" id="ext" value="中國(guó)">.中國(guó)</td>
</tr>
</tbody></table></td>
</tr>
</tbody>
</form>
PHP代碼:
<?php
//得到頂級(jí)域名
$ext=$_POST['ext'];
//得到二級(jí)域名
$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,0,3);
if($status=="210"){
echo ":恭喜您,可以注冊(cè)";
}else if($status=="211"){
echo ":已經(jīng)注冊(cè)";
}else if($status=="212"){
echo ":參數(shù)錯(cuò)誤";
}
echo '<br>';
}
?>
相關(guān)文章
laravel 判斷查詢數(shù)據(jù)庫(kù)返回值的例子
今天小編就為大家分享一篇laravel 判斷查詢數(shù)據(jù)庫(kù)返回值的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-10-10
Laravel框架實(shí)現(xiàn)發(fā)送短信驗(yàn)證功能代碼
這篇文章主要介紹了Laravel框架實(shí)現(xiàn)發(fā)送短信驗(yàn)證的相關(guān)資料,非常錯(cuò)具有參考借鑒價(jià)值,需要的朋友可以參考下2016-06-06
php 流程控制switch的簡(jiǎn)單實(shí)例
下面小編就為大家?guī)?lái)一篇php 流程控制switch的簡(jiǎn)單實(shí)例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-06-06
升級(jí) PHP7.1 后 openssl 解密 mcrypt AES 數(shù)據(jù)不兼容問(wèn)題的處理方法
這篇文章主要介紹了升級(jí) PHP7.1 后 openssl 解密 mcrypt AES 數(shù)據(jù)不兼容問(wèn)題的處理方法,需要的朋友可以參考下2018-07-07
PHP 網(wǎng)站修改默認(rèn)訪問(wèn)文件的nginx配置
這篇文章主要介紹了PHP 網(wǎng)站修改默認(rèn)訪問(wèn)文件的nginx配置,需要的朋友可以參考下2017-05-05
php遞歸函數(shù)三種實(shí)現(xiàn)方法及如何實(shí)現(xiàn)數(shù)字累加
實(shí)現(xiàn)遞歸函數(shù)有哪些方法呢?如何用遞歸函數(shù)實(shí)現(xiàn)數(shù)字累加?這篇文章就主要介紹php遞歸函數(shù)三種實(shí)現(xiàn)方法及如何實(shí)現(xiàn)數(shù)字累加,需要的朋友可以參考下。2015-08-08
PHP寫的簡(jiǎn)單數(shù)字驗(yàn)證碼實(shí)例
下面小編就為大家?guī)?lái)一篇PHP寫的簡(jiǎn)單數(shù)字驗(yàn)證碼實(shí)例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-05-05
HTTP頭隱藏PHP版本號(hào)實(shí)現(xiàn)過(guò)程解析
這篇文章主要介紹了HTTP頭隱藏PHP版本號(hào)實(shí)現(xiàn)過(guò)程解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-12-12
如何在Laravel5.8中正確地應(yīng)用Repository設(shè)計(jì)模式
這篇文章主要介紹了如何在Laravel5.8中正確地應(yīng)用Repository設(shè)計(jì)模式,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-11-11

