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>