其实和做单一的域名查询别无多样,闲话不说,具体是利用再循环查询域名而已.还有我使用不是万网提供的域名查询接口.因为当查询的域名长度少于2位时,就会显示"有问题的域名:..."提示,它查询域名的速度不理想,慢得很,经常弹出"连接超时"提示,这可能是免费提供域名接口的缘故吧,不知道有没有网友体验过呢?
我是使用www.checkdomain.com提供域名查询接口,查询速度蛮理想的. 先说明 http://www.checkdomain.com/cgi-bin/checkdomain.pl?domain=后面是直接查询域名的名字.例如要查询aa.com,那么url就是http://www.checkdomain.com/cgi-bin/checkdomain.pl?domain=aa.com
具体分三部分完成 1.form的内容 <form name="form1" method="post" onSubmit="javascript:return check()"> <table width="400" height="150" border="0" align="center" cellpadding="0" cellspacing="0"> <tr class="td"> <td colspan="2">域名查询系统:</td> </tr> <tr class="td"> <td valign="middle"><div align="center">www. <input name="dns" type="text" id="dns"> </div></td> <td><input type="submit" name="Submit" value="查询"></td> </tr> <tr class="td"> <td colspan="2"><p align="center"> <input name="checkbox" type="checkbox" id="checkbox" value="com" checked> .com <input type="checkbox" name="checkbox" value="net"> .net <input type="checkbox" name="checkbox" value="org"> .org <input type="checkbox" name="checkbox" value="cn"> .cn </p> <p align="center"> <input type="checkbox" name="checkbox" value="com.cn"> .com.cn <input type="checkbox" name="checkbox" value="net.cn"> .net.cn <input type="checkbox" name="checkbox" value="org.cn"> .org.cn </p></td> </tr> </table>
2.获取的复选框的内容,并转为数组,再利循环查询域名 <% if request.Form("Submit")="查询" then types=split(request.form("checkbox"),",") '获取当前选择的类型 dns=trim(request.form("dns")) for i=0 to ubound(types) edns=dns & "." & trim(types(i)) url="http://www.checkdomain.com/cgi-bin/checkdomain.pl?domain="& edns wstr=getHTTPPage(url) if instr(lcase(wstr),"registered")>0 then response.write "<a href='whois.asp?domain="& edns & "'target='_blank'>" & edns &":已被注册</a><br>" else response.write edns &":可用域名<br>" end if next end if %> 3.whois.asp页面 避免出现乱码 将 getHTTPPage=BytesToBstr(t,"GB2312") 改为 getHTTPPage=BytesToBstr(t,"utf-8")
再截取输出所需域名注册信息 .... wstr=getHTTPPage(url) wstr=left(wstr,instrrev(lcase(wstr),"this domain")-7) si=instr(lcase(wstr),"for you.")+8 wstr=mid(wstr,si,len(wstr)) response.Write wstr ...
上述难免有些错误,欢迎大家指正! |