写的很简单,只是实现了功能
<%
Functionformaturl(yes)
Ifmid(yes,5,1)<>""then
yes1=left(yes,3)
yes2=right(yes,cint(len(yes))-3)
formaturl=yes1&"."&yes2
else
formaturl=yes
endif
EndFunction
'取得远程网页二进制源代码
FunctiongetBoy(url)
'onerrorresumenext
SetobjXml=Server.CreateObject("Microsoft.XmlHttp")
withobjXml
.open"get",url,false,"",""
.send
getBoy=.responsebody
endwith
getBoy=BytesToBstr(GetBoy,"GB2312")
SetobjXml=nothing
endfunction
'处理二进制流代码
FunctionBytesToBstr(strBody,CodeBase)
dimobjStream
setobjStream=Server.CreateObject("Adodb.Stream")
objStream.Type=1
objStream.Mode=3
objStream.Open
objStream.WritestrBody
objStream.Position=0
objStream.Type=2
objStream.Charset=CodeBase
BytesToBstr=objStream.ReadText
objStream.Close
setobjStream=nothing
EndFunction
%>
未注册的域名如下
<%
'www.knowsky.com如果提交了查询
IfRequest.Form("yes")<>""Then
yes=replace(Request.Form("yes"),"","")'去除复选框字符串中的空格
yes=split(yes,",")'实例化一个数组yes,将用逗号隔开的yes数组赋值给yes新数组
Fori=0toubound(yes)'遍历数组循环开始
url="http://panda.www.net.cn/cgi-bin/Check.cgi?domain="&Request.Form("domain")&"&ext="&yes(i)
wstr=getBoy(url)'获取查询后的源代码
Ifinstr(wstr,"未被注册的域名")<>0Then'判断是否为已经注册的域名
Response.WriteRequest.Form("domain")&"."&formaturl(yes(i))&"<br><br><br><br>"'列出未注册的域名
EndIf
Next
response.Write"<p><p><p>已注册的域名如下:<br>"
Fori=0toubound(yes)'遍历数组循环开始
url="http://panda.www.net.cn/cgi-bin/Check.cgi?domain="&Request.Form("domain")&"&ext="&yes(i)
wstr=getBoy(url)'获取查询后的源代码
Ifinstr(wstr,"已被注册的域名")<>0Then'判断是否为已经注册的域名
Response.WriteRequest.Form("domain")&"."&formaturl(yes(i))&"<br><br><br><br>"'列出已注册的域名
EndIf
Next
Else
%>
<formname="form1"method="post"action="">
<p>
<inputname="domain"type="text"id="domain">
<inputtype="submit"name="Submit"value="查询">
</p>
<p>
<inputname="yes"type="checkbox"id="yes"value="com">
.com
<inputname="yes"type="checkbox"id="yes"value="net">
.net
<inputname="yes"type="checkbox"id="yes"value="org">
.org</p>
<p>
<inputname="yes"type="checkbox"id="yes"value="comcn">
.com.cn
<inputname="yes"type="checkbox"id="yes"value="netcn">
.net.cn
<inputname="yes"type="checkbox"id="yes"value="orgcn">
org.cn
<inputname="yes"type="checkbox"id="yes"value="govcn">
gov.cn</p>
<p>
<inputname="yes"type="checkbox"id="yes"value="info">
.info
<inputname="yes"type="checkbox"id="yes"value="biz">
.biz
<inputname="yes"type="checkbox"id="yes"value="tv">
.tv
<inputname="yes"type="checkbox"id="yes"value="cc">
.cc</p>
<p>
<inputname="yes"type="checkbox"id="yes"value="cn">
.cn
<inputname="yes"type="checkbox"id="yes"value="name">
.name</p>
</form>
<%
EndIf
%>