This article describes how to use XMLHTTP to create a domain name query system code case, which has some reference value. let's take a look at it.
How to use XMLHTTP to create a domain name query system code case
<% On Error Resume NextServer. scriptTimeOut = 9999999 Function getHTTPPage (Path) t = GetBody (Path) getHTTPPage = BytesToBstr (t, "GB2312") End 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 = NothingEnd 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 = nothingEnd Function %> <% if request ("domain") <> "then' url =" 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) 'www .knowsky.com 'response. write Instr (wstr, "can be registered") if instr (lcase (wstr), "registered domain name")> 0 then body = "the domain name has been registered" elseif instr (lcase (wstr), "unregistered domain name")> 0 then body = "the domain name is not registered" else body = "network delay. please try again" end if %>
Domain name query system: <% if request ("domain")> "" then response. write (request ("domain ")&". "& request (" root ") & body) end if %> |
|
I have tested the code locally. Normal.
The above is a detailed example of how to use XMLHTTP to create a domain name query system code case. For more information, see other related articles in the first PHP community!