開發這樣一個域名查詢系統其實是一件很容易的事情,只要我們能夠讓使用者進行查詢后得出結果,看看自己輸入的域名是不是被別人占用了就可以,如果沒有被占用我們就可以自行去申請了。
<% On Error Resume Next Server.ScriptTimeOut=9999999 Function getHTTPPage(Path) t = GetBody(Path) getHTTPPage=BytesToBstr(t,"GB2312") End function Function GetBody(url) on error resume next Set Retrieval = CreateObject("Microsoft.XMLHTTP") With Retrieval .Open "Get", url, False, "", "" .Send GetBody = .ResponseBody End With Set Retrieval = Nothing End Function
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 %> <% if request("domain")<>"" then 'url="http://panda.www.net.cn/cgi-bin/Whois.cgi?domain="&request("domain")&"&"&request("root")&"=yes&work=whois&referer=http://panda.www.net.cn/cgi-bin/Check.cgi?domain="&request("domain") url="http://panda.www.net.cn/cgi-bin/Check.cgi?domain="&request("domain")&"&ext="&request("root") wstr=getHTTPPage(url)
'response.write Instr (wstr,"可以注冊") if instr(lcase(wstr),"已被注冊的域名")>0 then body="域名已經被注冊" elseif instr(lcase(wstr),"未被注冊的域名")>0 then body="域名未被注冊" else body="網絡延遲,請重新查找" end if end if %>
域名查詢系統:<% if request("domain")>"" then response.Write(request("domain")&"."&request("root")&body) end if%> |
|
|