网站首页 > 书籍教程 > ASP教程 > 使用XMLHTTP制作域名查询系统

使用XMLHTTP制作域名查询系统

  • 作者:互联网
  • 时间:2009-06-23 17:03:55

<%
On Error Resume Next
Se***r.ScriptTimeOut=9999999
Function getHTTPPage(Path)
        t = GetBody(Path)
  getHTTPPage=BytesToBstr(t,"GB2312")
End function

Function GetBody(url)
        on error resume next
        Set Retrieval = CreateObject("Mi***soft.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 = Se***r.CreateObject("ad***.stream")
        ob***ream.Type = 1
        ob***ream.Mode =3
        ob***ream.Open
        ob***ream.Write body
        ob***ream.Position = 0
        ob***ream.Type = 2
        ob***ream.Charset = Cset
        BytesToBstr = ob***ream.ReadText
        ob***ream.Close
        set objstream = nothing
End Function
%>
<%
if request("domain")<>"" then
'url="http://pa***www.net.cn/cgi-bin/Whois.cgi?domain="&request("domain")&"&"&request("root")&"=yes&work=whois&referer=h***//panda.www.net.cn/cgi-bin/Check.cgi?domain="&request("domain")
url="http://pa***www.net.cn/cgi-bin/Check.cgi?domain="&request("domain")&"&ext="&request("root")
wstr=getHTTPPage(url)
'ww***nowsky.com
're***nse.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 re***nse.Write(request("domain")&"."&request("root")&body) end if%>

       
         
           
        
       
       
         
       
     
www.
               
               
             


             
           

           

 



 
   
 


       

         
         
          on***ck=document.search_form.action='http://search.sohu.com/web' style="font-size:14px;width=40;height=20">
           

     

代码我已经在本地测试过了。正常通过。
文章里面的用到的Mi***soft.XMLHTTP组件。其用法请参见:ww***nowsky.com/5190.html">http://ww***nowsky.com/5190.html