当前页面位置: » 丰搜网 » 文档中心 » 详细内容
新手初练:用asp做一个域名查询系统
开发这样一个域名查询系统其实是一件很容易的事情,只要我们能够让使用者进行查询后得出结果,看看自己输入的域名是不是被别人占用了就可以,如果没有被占用我们就可以自行去申请了。
| <% on error resume next server.scripttimeout=9999999 function gethttppage(path) t = getbody(path) gethttppage=bytestobstr(t,"gb2312") end functionfunction 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 %> <table width="40%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#999999"> <tr> <td height="26" bgcolor="efefef">域名查询系统:<% if request("domain")>"" then response.write(request("domain")&"."&request("root")&body) end if%></td> </tr> |