关于ASP查询国际域名的问题

怎么用ASP查询国际域名是否被注册还有就是统计域名的数量
---------------------------------------------------------------

//kesee.asp

1@ Language=VBScript 
 1<html><head>
 2<title>21cndns.com 域名查询系统</title>
 3<style type="text/css">   
 4<!--   
 5body { font-family: "宋体"; font-size: 9pt}   
 6\-->   
 7</style>
 8<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 9<script language="javascript1.2">   
10  
11function CheckIfEnglish( String )   
12{   
13var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";   
14var i;   
15var c;   
16if(String.charAt( 0 )=='-')   
17return false;   
18if( String.charAt( String.length - 1 ) == '-' )   
19return false;   
20for( i = 0; i < String.length; i ++ )   
21{   
22c = String.charAt( i );   
23if (Letters.indexOf( c ) < 0)   
24return false;   
25}   
26return true;   
27}   
28function submitchecken() {   
29  
30if (document.checkdomain.domain.value == "") {   
31alert("请输入您要查询的英文域名。");   
32document.checkdomain.domain.focus();   
33return false;   
34}   
35  
36if (!CheckIfEnglish(document.checkdomain.domain.value )) {   
37alert("\t注意:在查询英文域名时应输入英文不能输入中文及非法字符!\n域名由不分大小写的英文字母和数字组成,除了开头和结尾以外,中间也可以含有“-”(即连字符或称减号)最大长度为26个字符;");   
38document.checkdomain.domain.focus();   
39return false;   
40}   
41  
42return true;   
43}   
44</script>
45</head>
46<body>   

on error resume next
Private d_exsit
Dim Retrieval
Dim Domain
Dim TakenHTML

Function GetURL(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.","") &amp; "." &amp; Request.Form("ext")
if Domain=".com" or Request.Form("domain")="" then
Response.Write ("<script>alert('看看您什么忘记填写了?没有填写域名吧?');javascript:history.back(1)</script>")
response.end
end if
'TakenHTML = GetURL("http://www.internic.net/cgi/whois?whois_nic="&amp;Domain&amp;"&amp;type=domain")
TakenHTML = GetURL("http://www.china-channel.com/checkdomain.asp?action=whois&amp;domain=" &amp; Domain)
d_exsit=1
if InStr(TakenHTML,"No entries") &gt; 1 then

Response.Write Domain &amp; "出错了,请返回!<br/><br/>"
else
if InStr(TakenHTML,"No match") &gt; 1 then

1<font color="red" size="6">祝贺您:</font><font size="3"><p>您想注册的域名   
2<b>[ ```
3 =Domain 
4``` ]还没有被注册</b><p><a href="http://www.21cndns.com/domain.htm">   
5点击这里,开始注册您的域名</a></p></p></font>   

else

 1<font color="red" size="6">对不起:</font><font size="3"><p>您想注册的域名   
 2<b>[ ```
 3 =Domain 
 4``` ]已经被注册了!</b><p></p>请您换个域名再试;</p></font><font 3""="" size="">
 5<form action="kesee.asp" id="Form1" method="post" name="checkdomain">   
 6www.<input id="Text1" name="domain" size="20" type="text"/>
 7<select id="Select1" name="ext">
 8<option selected="" value="com">.com</option>
 9<option value="net">.net</option>
10<option value="org">.org</option>
11<option value="com.cn">.com.cn</option>
12<option value="net.cn">.net.cn</option>
13<option value="org.cn">.org.cn</option>
14<option value="cc">.cc</option>
15<option value="tv">.tv</option>
16<option value="biz">.biz</option>
17<option value="info">.info</option>
18</select>
19<input id="Submit1" name="Submit" onclick="return submitchecken();" type="submit" value="查询"/>
20</form><font size="6">以下是此域名的详细注册信息</font>
21<pre>```
22 =dowith() 
23```</pre></font>   

end if
end if
'#################################查询域名的详细注册情况的代码开始####################################
Function dowith()
Dim lStrURL
Dim pagebefore
Dim pageafter
Dim tempcontent
Dim pagestart
Dim pageend
dim temps
pageafter = "<pre>"
pagebefore = "</pre>"
tempcontent = TakenHTML
if d_exsit&lt;&gt;0 then
pagestart = InStr(1,tempcontent, pageafter,1)
If pagestart = 0 Then
dowith = "<font color="" red""="">意外的错误2!</font>"
d_exsit = 3
Exit Function
Else
pagestart = pagestart + Len(pageafter) + 1
pageend = InStr(pagestart, tempcontent, pagebefore,1)
If pageend = 0 Then
dowith = "<font color="" red""="">意外的错误!</font>"
d_exsit = 3
Exit Function
Else
pageend = pageend - pagestart '得到内容长度
tempcontent = Mid(tempcontent, pagestart, pageend)
End If
End If
Set pageregexp = New RegExp
pageregexp.Global = True
pageregexp.Pattern = "&lt;[^&gt;]*&gt;"
tempcontent = pageregexp.Replace(tempcontent, "")
Set pageregexp = Nothing
dowith = tempcontent
End If
End Function
'#################################查询域名的详细注册情况的代码结束####################################

1<a href="index.htm">返回首页</a>
2<p> </p>
3</body>
4</html>
 1<html><head>
 2<title>21cndns.com 域名查询系统</title>
 3<style type="text/css">   
 4<!--   
 5body { font-family: "宋体"; font-size: 9pt}   
 6\-->   
 7</style>
 8<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 9<script language="javascript1.2">   
10  
11function CheckIfEnglish( String )   
12{   
13var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";   
14var i;   
15var c;   
16if(String.charAt( 0 )=='-')   
17return false;   
18if( String.charAt( String.length - 1 ) == '-' )   
19return false;   
20for( i = 0; i < String.length; i ++ )   
21{   
22c = String.charAt( i );   
23if (Letters.indexOf( c ) < 0)   
24return false;   
25}   
26return true;   
27}   
28function submitchecken() {   
29  
30if (document.checkdomain.domain.value == "") {   
31alert("请输入您要查询的英文域名。");   
32document.checkdomain.domain.focus();   
33return false;   
34}   
35  
36if (!CheckIfEnglish(document.checkdomain.domain.value )) {   
37alert("\t注意:在查询英文域名时应输入英文不能输入中文及非法字符!\n域名由不分大小写的英文字母和数字组成,除了开头和结尾以外,中间也可以含有“-”(即连字符或称减号)最大长度为26个字符;");   
38document.checkdomain.domain.focus();   
39return false;   
40}   
41  
42return true;   
43}   
44</script>
45</head>
46<body bgcolor="#FFFFFF">
47<p>
48<p>
49<p>
50<p>
51<table align="center" border="1" bordercolordark="#FFFFFF" bordercolorlight="#000000" cellpadding="0" cellspacing="0" width="320">
52<tr bgcolor="#CCCCCC" valign="middle">
53<td height="60">
54<form action="kesee.asp" id="Form1" method="post" name="checkdomain">   
55www.<input id="Text1" name="domain" type="text"/>
56<select id="Select1" name="ext">
57<option selected="" value="com">.com</option>
58<option value="net">.net</option>
59<option value="org">.org</option>
60<option value="com.cn">.com.cn</option>
61<option value="net.cn">.net.cn</option>
62<option value="org.cn">.org.cn</option>
63<option value="cc">.cc</option>
64<option value="tv">.tv</option>
65<option value="biz">.biz</option>
66<option value="info">.info</option>
67</select>
68<input id="Submit1" name="Submit" onclick="return submitchecken();" type="submit" value="查询"/>
69</form>
70</td>
71</tr>
72</table>
73<p> </p>
74<p align="center">21cndns.com 域名查询系统  &amp;</p></p></p></p></p></body></html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus