| 以下为引用的内容:
<% private function bytes2bstr(vin)
dim i, thischrcode, nextchrcode strreturn = "" for i = 1 to lenb(vin)
thischrcode = ascb(midb(vin, i, 1))
if thischrcode < !amp;h80 then strreturn = strreturn !amp; chr(thischrcode)
else nextchrcode = ascb(midb(vin, i + 1, 1))
strreturn = strreturn !amp; chr(clng(thischrcode) * !amp;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=!amp;url=" !amp; 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 |