用ASP程序调用Alexa世界排名的代码源码精华教程
|
| 论文作者:佚名 论文来源:不详 论文发布时间:2006-6-20 2:40:52 论文发布人:chjchjchj |
减小字体
增大字体
<% 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:// Response.write(GetAlexaRank2(url)) '输出排名数据
%>
(出处:
|
|
|
|
|
|
|
| ∷相关技术评论 |
(评论内容只代表网友观点,与本站立场无关!) [查看发表评论...] | |
|
|
| |
站内广告 |
| |
|
站内搜索 |
| |
栏目导航 |
| |
|
|
本月热门 |
| |
|
|
本日热门 |
| |
|
|
|