欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

使用XMLHTTP制作域名查询系统

程序员文章站 2023-11-09 08:08:40
<%on error resume nextserver.scripttimeout=9999999function gethttppage(path)   &n...

<%
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.xml(标准化越来越近了)http")
        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="https://panda.www.net.cn/cgi-bin/whois.cgi?domain="&request("domain")&"&"&request("root")&"=yes&work=whois&referer=https://panda.www.net.cn/cgi-bin/check.cgi?domain="&request("domain")
url="https://panda.www.net.cn/cgi-bin/check.cgi?domain="&request("domain")&"&ext="&request("root")
wstr=gethttppage(url)
www.knowsky.com
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>