您的位置:首页 > 编程语言

万网(.net.cn)域名注册查询代码

2006-09-09 10:49 781 查看
万网(.net.cn)域名注册查询代码,整理了一下下面的网页代码。http://www.ip126.com/school/Article_Show.asp?ArticleID=343

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
'输入url目标网页地址,返回值是目标网页的HTML代码
Function GetHTTPPage(url)
Dim Http
Set Http=Server.Createobject("MsXml2.XmlHttp")
Http.Open "GET",url,False
Http.Send()
If Http.Readystate<>4 Then
Exit Function
End If
getHTTPPage=BytesToBSTR(Http.ResponseBody,"GB2312")
Set Http=Nothing
If Err.Number<>0 Then Err.Clear
End Function

'转换乱玛,直接用XMLHTTP调用有中文字符的网页得到的将是乱码
'可以通过Adodb.Stream组件进行转码
Function BytesToBstr(body,Cset)
Dim objstream
Set objstream = Server.CreateObject("Adodb.Stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function

'下面试着调用www.net.cn的html内容
Dim Url,Html,MM
If request("domain")<>"" And request("ext")<>"" Then
Url="http://panda.www.net.cn/cgi-bin/Check.cgi?domain="&request("domain")&"&big5=n&"&request("ext")&"=yes"
Html = GetHTTPPage(Url)
If instr(Html,"未被注册的域名") then
ext=request("ext")
n=len(ext)
ext2=right(ext,n-1)

MM = "恭喜,您查询的域名 <font color=#ff0000>"&request("domain")&"."&request("ext")&"</font> 还未被注册!建议您抢先注册。"
ElseIf instr(Html,"已被注册的域名") then
MM = "抱歉,您查询的域名 <font color=#ff0000>"&request("domain")&"."&request("ext")&"</font> 已经被注册,请重新查询。"
Else
MM = "抱歉,系统在查询域名 <font color=#ff0000>"&request("domain")&"."&request("ext")&"</font> 时遇到网络错误,请重新查询。"
End If
Else
MM=""
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>域名查询(ASP)-Nanyang</title>
</head>

<body>

<p style=" text-indent:2em; line-height:2em; width:540px;" align="left">
<form name="checkdomain" method="post">
<script type="text/javascript" language="javascript">
//--域名查询js判断文件
function CheckIfEnglish( String )
{
var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";
var i;
var c;
if(String.charAt( 0 )=='-')
return false;
if( String.charAt( String.length - 1 ) == '-' )
return false;
for( i = 0; i < String.length; i ++ )
{
c = String.charAt( i );
if (Letters.indexOf( c ) < 0)
return false;
}
return true;
}

function submitchecken3() {

if (document.checkdomain.domain.value == "") {
alert("请输入您要查询的英文域名。");
document.checkdomain.domain.focus();
return false;
}

if (!CheckIfEnglish(document.checkdomain.domain.value )) {
alert("在查询英文域名应输入英文不能输入中文及非法字符!");
document.checkdomain.domain.focus();
return false;
}
return true;
}
</script>
<table border="0" cellSpacing="0" cellPadding="0" align="center">
<tr><td>域名查询</td><td>
<input style="BORDER-RIGHT:#ff6600 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #ff6600 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; BORDER-LEFT: #ff6600 1px solid; WIDTH: 135px; PADDING-TOP: 2px; BORDER-BOTTOM: #ff6600 1px solid; HEIGHT: 18px; BACKGROUND-COLOR: #ffffff" name="domain"></td>
<td align="left"><input name="img" type="submit" onclick="return submitchecken3();" value="开始查询"></td>
</tr>
<tr><td colspan="3">
<strong>
<input type="radio" value="com" name="ext" checked="checked">.com
<input type="radio" value="net" name="ext">.net
<input type="radio" value="cn" name="ext">.cn
<input type="radio" value="com.cn" name="ext">.com.cn
<input type="radio" value="net.cn" name="ext">.net.cn<br>
<input type="radio" value="org" name="ext">.org
<input type="radio" value="biz" name="ext">.biz
<input type="radio" value="cc" name="ext">.cc
<input type="radio" value="info" name="ext">.info
<input type="radio" value="org.cn" name="ext">.org.cn
</strong>
</td></tr></table></form>
<%= MM %>
</p>

</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: