【alexa imax】alexa查询代码

更新时间:2016-04-10    来源:php常用代码    手机版     字体:

【www.bbyears.com--php常用代码】

alexa查询代码
<%
If request("d")="" Then
Response.Redirect "myalexa.asp?d=111cn.net"
End If
on error resume next
"远程截取函数开始
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,"     str=replace(str,"""/>","")
    str=replace(str," ","")
del=str
End Function
dim wd
wd=Request("d")
"截取网址
url="http://data.alexa.com/data/?cli=10&dat=snba&ver=7.0&url="&wd
        wstr=getHTTPPage(url)

%>

<%=Request("d")%>的alexa综合排名查询结果







http://www.alexa.com/siteinfo/<%=wd%>" target=_blank

class=alexarank>
<%
"截取数据
set reg=new Regexp
 reg.Multiline=True
 reg.Global=Flase
 reg.IgnoreCase=true
 reg.Pattern=""
 Set matches = reg.execute(wstr)
  For Each match1 in matches
   bodypage=del(match1.Value)
  Next
Set matches = Nothing
Set reg = Nothing
Response.Write bodypage
%>

本文来源:http://www.bbyears.com/jiaocheng/23058.html

猜你感兴趣