网站运营优化 » 编程 » 使用xmlhttp查询域名是否被注的ASP小程序

使用xmlhttp查询域名是否被注的ASP小程序

使用xmlhttp查询域名是否被注的ASP小程序

提交查询的页面比较简单如下:
=====
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
</HEAD>
<BODY>
<form method="post" action="return-whois.asp" ID=Form1>
<input type="text" name="domain" ID=Text1>
<select name="ext" ID=Select1>
<option value="com">.com</option>
<option value="net">.net</option>
<option value="org">.org</option>
</select>
<input type="submit" name="Submit" value="WhoIs" ID=Submit1>
</form>
</BODY>
</HTML>
==============
return-whois.asp
=======
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
</HEAD>
<BODY>
<%
on error resume next
Dim Retrieval
Dim Domain
Dim TakenHTML
Function GetURL(url)
'Response.Write url
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
GetURL = .ResponseText
End With
Set Retrieval = Nothing
End Function
Domain = Replace(Request.Form("domain"),"www.","") & "." & Request.Form("ext")
TakenHTML = GetURL("http://www.internic.net/cgi/whois?whois_nic="&Domain&"&type=domain")
'这里他通过查找error和no match来判断是否出错,或是否被注,这可能是whois那里返回的takenhtml的功劳
if InStr(TakenHTML,"Error") > 1 then
'If the page html contains "Error"
Response.Write Domain & "出错了!<br><br>"
else
if InStr(TakenHTML,"No match") > 1 then
Response.Write Domain&"还没有被注册<br><br>"
else
Response.Write Domain&"已经被注册了<br><br>"
end if
end if
%>

</BODY>
</HTML>
=======
不过在内部网上好想不行,老是"被注册了",大家试试吧!!

相关文章

发表留言


点击更换验证码