Implementation of domain name batch query

Source: Internet
Author: User

<%
On Error Resume Next
Server. ScriptTimeOut = 9999999

Action = Request. QueryString ("action ")

Function getHTTPPage (Path)
T = GetBody (Path)
GetHTTPPage = BytesToBstr (t, "GB2312 ")
End function
Function CleanHtml (str)
Dim RegEx
Set RegEx = New RegExp
RegEx. Pattern = "<\/* [^ <>] *> | {\/* [^ {}] *>"
RegEx. Global = True
CleanHtml = RegEx. Replace (str ,"")
End Function
Function GetBody (url)
On error resume next
Set Retrieval = CreateObject ("Microsoft. XMLHTTP ")
With Retrieval
. Open "Get", url, False ,"",""
. Send
GetBody =. ResponseBody
End
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 action = "do" then
Domain = trim (Request. Form ("domain "))
Root = trim (Request. Form ("root "))
If Len (domain) = 0 Or Len (root) = 0 Then
Response. Write "the two cannot be blank"
Response. End ()
End If

Domain = Replace (domain ,"'","")
Root = Replace (root ,"'","")
ArrRoot = Split (root ,",")
Body = ""

For I = 0 To ubound (arrRoot) 'queries the list of multiple domain name suffixes in a loop
Url = "http://panda.www.net.cn/cgi-bin/Check.cgi? Domain = "& trim (domain) &" & ext = "& trim (arrRoot (I ))
SDomain = trim (domain) & "." & trim (arrRoot (I ))

Wstr = CleanHtml (getHTTPPage (url ))

If instr (lcase (wstr), "already registered")> 0 then
Body = body & "<a href = whois. asp? Domain = "& sDomain &" target = 'new' title = 'click to view WHOIS of this domain name> domain name "& sDomain &" already registered, click to view WHOIS </a> <br>"
Elseif instr (lcase (wstr), "not registered")> 0 then
Body = body & "<a href = 'domainregister. asp? Domain = "+ sDomain +" 'target = 'new' title = 'click to register this domain name'> domain name "& sDomain &" is not registered, click to register this domain name </a> <br>"
Else
Body = body & "Domain Name" & sDomain & "the query times out. Please search again <br>"
End If
'Response. write "<textarea rows = '4' style = 'width: 80% '> "& wstr &" </textarea> <br> "& sDomain &" <br> "& body &" <br>"
Next
%>

<Table border = "0" width = "550" cellspacing = "0" cellpadding = "0" align = center>
<Tr bgcolor = "# EFEFEF">
<Td height = "30"> <strong> domain name query result: </strong> </td>
</Tr>
<Tr>
<Td style = "padding-left: 20px; line-height: 200%;">
<%
If body = "" then
Response. write "domain name query error! "
Else
Response. write body
End If
%>
</Td>
</Tr>
</Table> <br>
<% End If %>

<Table border = "0" width = "550" cellspacing = "0" cellpadding = "0" align = center>
<FORM action = "? Action = do "method =" post ">
<Tr bgcolor = "# EFEFEF">
<Td height = "30">

<INPUT size = 25 name = "domain">
</Td>
<Td height = "34" width = "30%" style = "padding-left: 10px;"> <INPUT type = submit value = ""> </td>
</Tr>
<Tr>
<Td colspan = 2 align = center>
<TABLE class = eng cellSpacing = 0 cellPadding = 0 width = "95%" border = 0>
<TR>
<TD> <INPUT type = "checkbox" value = "com" name = "root" Checked>. com </TD>
<TD> <INPUT type = "checkbox" value = "net" name = "root" Checked>. net </TD>
<TD> <INPUT type = "checkbox" value = "org" name = "root">. org </TD>
<TD> <INPUT type = "checkbox" value = "cn" name = "root" Checked>. cn </TD>
<TD> <INPUT type = "checkbox" value = "info" name = "root">. info </TD> </TR>
<TR>
<TD> <INPUT type = "checkbox" value = "com.cn" name = "root"> .com.cn </TD>
<TD> <INPUT type = "checkbox" value = "net.cn" name = "root"> .net.cn </TD>
<TD> <INPUT type = "checkbox" value = "org.cn" name = "root"> .org.cn </TD>
<TD> <INPUT type = "checkbox" value = "biz" name = "root">. biz </TD>
<TD> <INPUT type = "checkbox" value = "name" name = "root">. name </TD>
</TR>
<TR>
<TD> <INPUT type = "checkbox" value = "cc" name = "root">. cc </TD>
<TD> <INPUT type = "checkbox" value = "TV" name = "root">. TV </TD>
<TD> <INPUT type = "checkbox" value = "mobi" name = "root">. mobi </TD>
<TD> <INPUT type = "checkbox" value = "network" name = "root">. Network </TD>
<TD> <INPUT type = "checkbox" value = "" name = "root">. Company </TD>
</TR>
</TABLE>
</Td>
</Tr>
</Form>
</Table>

<Div id = divProcessing style = "width: 200px; height: 30px; position: absolute; left: 70px; top: 180px; display: none; FILTER: alpha (opacity = 65); ">
<Table border = 0 cellpadding = 0 cellspacing = 1 bgcolor = "#3A6EA5" width = "100%" height = "100%"> <tr> <td bgcolor = # feffef>
<br>
<Marquee align = "middle" behavior = "alternate" scrollamount = "5"> <font color = # FF0000>... querying... please wait... </font> </marquee> </td> </tr> </table>
</Div>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.