写的很简单,只是实现了功能
1
2Function formaturl(yes)
3If mid(yes,5,1)<>"" then
4yes1 = left(yes,3)
5yes2 = right(yes,cint(len(yes))-3)
6formaturl = yes1 & "." & yes2
7else
8formaturl=yes
9end if
10End Function
11'取得远程网页二进制源代码
12Function getBoy(url)
13'on error resume next
14Set objXml = Server.CreateObject("Microsoft.XmlHttp")
15with objXml
16.open "get",url,false,"",""
17.send
18getBoy = .responsebody
19end with
20getBoy = BytesToBstr(GetBoy,"GB2312")
21Set objXml = nothing
22end function
23
24'处理二进制流代码
25Function BytesToBstr(strBody,CodeBase)
26dim objStream
27set objStream = Server.CreateObject("Adodb.Stream")
28objStream.Type = 1
29objStream.Mode =3
30objStream.Open
31objStream.Write strBody
32objStream.Position = 0
33objStream.Type = 2
34objStream.Charset = CodeBase
35BytesToBstr = objStream.ReadText
36objStream.Close
37set objStream = nothing
38End Function
未注册的域名如下
1
2'www.knowsky.com如果提交了查询
3If Request.Form("yes") <> "" Then
4yes = replace(Request.Form("yes")," ","") '去除复选框字符串中的空格
5yes = split(yes,",") '实例化一个数组yes,将用逗号隔开的yes数组赋值给yes新数组
6
7For i = 0 to ubound(yes) '遍历数组循环开始
8url = " http://panda.www.net.cn/cgi-bin/Check.cgi?domain="&Request.Form("domain")&"&ext="&yes(i )
9wstr = getBoy(url) '获取查询后的源代码
10If instr(wstr,"未被注册的域名") <> 0 Then '判断是否为已经注册的域名
11Response.Write Request.Form("domain")&"."&formaturl(yes(i))&"
<br/>
<br/>
<br/>
<br/>
1" '列出未注册的域名
2End If
3Next
4response.Write "
<p><p><p>已注册的域名如下:<br/>"
For i = 0 to ubound(yes) '遍历数组循环开始
url = " http://panda.www.net.cn/cgi-bin/Check.cgi?domain="&amp;Request.Form("domain")&amp;"&amp;ext="&amp;yes(i )
wstr = getBoy(url) '获取查询后的源代码
If instr(wstr,"已被注册的域名") <> 0 Then '判断是否为已经注册的域名
Response.Write Request.Form("domain")&"."&formaturl(yes(i))&"<br/><br/><br/><br/>" '列出已注册的域名
End If
Next
Else
1<form action="" method="post" name="form1">
2<p>
3<input id="domain" name="domain" type="text"/>
4<input name="Submit" type="submit" value="查询"/>
5</p>
6<p>
7<input id="yes" name="yes" type="checkbox" value="com"/>
8.com
9<input id="yes" name="yes" type="checkbox" value="net"/>
10.net
11<input id="yes" name="yes" type="checkbox" value="org"/>
12.org </p>
13<p>
14<input id="yes" name="yes" type="checkbox" value="comcn"/>
15.com.cn
16<input id="yes" name="yes" type="checkbox" value="netcn"/>
17.net.cn
18<input id="yes" name="yes" type="checkbox" value="orgcn"/>
19org.cn
20<input id="yes" name="yes" type="checkbox" value="govcn"/>
21gov.cn </p>
22<p>
23<input id="yes" name="yes" type="checkbox" value="info"/>
24.info
25<input id="yes" name="yes" type="checkbox" value="biz"/>
26.biz
27<input id="yes" name="yes" type="checkbox" value="tv"/>
28.tv
29<input id="yes" name="yes" type="checkbox" value="cc"/>
30.cc</p>
31<p>
32<input id="yes" name="yes" type="checkbox" value="cn"/>
33.cn
34<input id="yes" name="yes" type="checkbox" value="name"/>
35.name </p>
36</form>
End If