世界排名代码
更新时间:2012/8/23 点击:1413次
<%
Private Function bytes2BSTR(vIn)
Dim i, ThischrCode, NextchrCode
strReturn = ""
For i = 1 To LenB(vIn)
ThischrCode = AscB(MidB(vIn, i, 1))
If ThischrCode < &H80 Then
strReturn = strReturn & Chr(ThischrCode)
Else
NextchrCode = AscB(MidB(vIn, i + 1, 1))
strReturn = strReturn & Chr(CLng(ThischrCode) * &H100 + CInt(NextchrCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
Function GetURL(url)
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
GetURL = .ResponseText
GetURL = bytes2BSTR(.Responsebody)
End With
Set Retrieval = Nothing
End Function
'以上是使用xmlhttp读取页面代码的通用代码
Function GetAlexaRank(url)
on error resume next
Dim tempstr,trueurl,x,keystr
trueurl = "http://www.alexa.com/data/details/traffic_details?q=&url=" & url
tempstr=GetURL(trueurl)
keystr = "</td><td class=""bodyBold"" align=""center"" bgcolor=""#ffffff""><img"
TempStr = split(TempStr,keystr)(0)
x = InstrRev(TempStr,">") + 1
TempStr = mid(TempStr,x)
if err then
GetAlexaRank=err.description
err.clear
else
GetAlexaRank=TempStr
end if
End Function
'以上是读取Alexa网站页面,对代码进行分析然后得到排名的数据
Dim url
url="www.lepoo.com" '要查询的网址,不要加http://'>http://
Response.write(GetAlexaRank2(url)) '输出排名数据
%>
Private Function bytes2BSTR(vIn)
Dim i, ThischrCode, NextchrCode
strReturn = ""
For i = 1 To LenB(vIn)
ThischrCode = AscB(MidB(vIn, i, 1))
If ThischrCode < &H80 Then
strReturn = strReturn & Chr(ThischrCode)
Else
NextchrCode = AscB(MidB(vIn, i + 1, 1))
strReturn = strReturn & Chr(CLng(ThischrCode) * &H100 + CInt(NextchrCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
Function GetURL(url)
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "GET", url, False, "", ""
.Send
GetURL = .ResponseText
GetURL = bytes2BSTR(.Responsebody)
End With
Set Retrieval = Nothing
End Function
'以上是使用xmlhttp读取页面代码的通用代码
Function GetAlexaRank(url)
on error resume next
Dim tempstr,trueurl,x,keystr
trueurl = "http://www.alexa.com/data/details/traffic_details?q=&url=" & url
tempstr=GetURL(trueurl)
keystr = "</td><td class=""bodyBold"" align=""center"" bgcolor=""#ffffff""><img"
TempStr = split(TempStr,keystr)(0)
x = InstrRev(TempStr,">") + 1
TempStr = mid(TempStr,x)
if err then
GetAlexaRank=err.description
err.clear
else
GetAlexaRank=TempStr
end if
End Function
'以上是读取Alexa网站页面,对代码进行分析然后得到排名的数据
Dim url
url="www.lepoo.com" '要查询的网址,不要加http://'>http://
Response.write(GetAlexaRank2(url)) '输出排名数据
%>