Alexa Query Code

Source: Internet
Author: User

Alexa query Code
<%
If request ("d") = "Then
Response.Redirect" myalexa.asp?d=111cn.net "
End If
on Error Resume Next
Remote intercept function start
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.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 ("ADO" & "Db.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
Function newstring (WSTR,STRNG)
Newstring=instr (LCase (WSTR), LCase (STRNG))
If Newstring<=0 then Newstring=len (WSTR)
End Function

Function del (str)
Str=replace (str, "<reach rank=" "", "")
Str=replace (str, "" "/>", "")
Str=replace (str, "", "")
Del=str
End Function
Dim wd
Wd=request ("D")
' Intercept web site
Url= "Http://data.alexa.com/data/?cli=10&dat=snba&ver=7.0&url=" &wd
Wstr=gethttppage (URL)

%>
<title><%=request ("D")%> Alexa comprehensive rankings query results </title>
<meta name= "Robots" content= "Noindex,nofollow"/>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<meta http-equiv= "Pragma" content= "No-cache"/>
<style type= "Text/css" >
body{
margin:0px; COLOR: #529252; font-size:11px; Font-weight:bold; Text-decoration:

None font-family: "Georgia", "Arial";}
a:link,a:visited {COLOR: #0066CC; font-size:12px; Font-weight:bold; text-

Decoration:underline;}
A:active,a:hover{color: #FF3300; font-size:12px; Font-weight:bold; text-

Decoration:underline;}
a.alexarank:link,a.alexarank:visited {COLOR: #529252; font-size:11px; font-

Weight:bold; Text-decoration:none; font-family: "Georgia", "Arial";}
a.alexarank:hover,a.alexarank:active {COLOR: #FF3300; font-size:11px; font-

Weight:bold; Text-decoration:none; font-family: "Georgia", "Arial";}
</style>
<body leftmargin=0 topmargin=0>
<div align= "center" >
<a href= "Http://www.alexa.com/siteinfo/<%=wd%>" Target=_blank

Class=alexarank>
<%
' Intercept data
Set Reg=new Regexp
Reg. Multiline=true
Reg. Global=flase
Reg. Ignorecase=true
Reg. Pattern= "<reach rank= (. | N) *?) > "
Set matches = Reg.execute (WSTR)
For each match1 in matches
Bodypage=del (match1. Value)
Next
Set matches = Nothing
Set reg = Nothing
Response.Write Bodypage
%>
</a>
</div></body>

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.