一聚教程网:一个值得你收藏的教程网站

热门教程

asp 写alexa 排名查询系统教程二

时间:2022-07-02 23:13:45 编辑:袖梨 来源:一聚教程网


Function lens(txt, length)
        Dim x, y, ii
        txt = Trim(txt)
        x = Len(txt)
        y = 0
        If x >= 1 Then
            For ii = 1 To x
                If Asc(Mid(txt, ii, 1)) < 0 Or Asc(Mid(txt, ii, 1)) > 255 Then
                    y = y + 2
                Else
                    y = y + 1
                End If
                If y >= length Then
                    txt = Left(Trim(txt), ii-3) & "..."
                    Exit For
                End If
            Next
            lens = txt
        Else
            lens = ""
        End If
End Function

Url = "http://data.alexa.com/data/?cli=10&dat=snba&ver=7.0&url="&Domain
strPage = GetPage(Url)
set xmldom=server.createobject("MSXML2.DOMDocument")  
xmldom.loadXML(strPage)
Set SD = xmldom.documentElement.selectSingleNode("SD")
Set SITE = xmldom.documentElement.selectSingleNode("DMOZ")
Dim ADDR
Dim CREATED
Dim PHONE
Dim OWNER
Dim EMAIL
Dim LANG
Dim LINKSIN
Dim SPEED
Dim POPULARITY
Dim RANK
Dim CHILD
Dim REACH
Set ADDR = SD.selectSingleNode("ADDR")
Set CREATED = SD.selectSingleNode("CREATED")
Set PHONE = SD.selectSingleNode("PHONE")
Set OWNER = SD.selectSingleNode("OWNER")
Set EMAIL = SD.selectSingleNode("EMAIL")
Set LANG = SD.selectSingleNode("LANG")
Set LINKSIN = SD.selectSingleNode("LINKSIN")
Set SPEED = SD.selectSingleNode("SPEED")
Set POPULARITY = SD.selectSingleNode("POPULARITY")
Set RANK = SD.selectSingleNode("RANK")
Set CHILD = SD.selectSingleNode("CHILD")
Set REACH = SD.selectSingleNode("REACH")
Dim SITEINFO
Dim CATS
Dim SiteTitle
Dim SiteDesc
Dim Cat
Set SITEINFO = SITE.selectSingleNode("SITE")
Set CATS = SITEINFO.selectSingleNode("CATS").selectSingleNode("CAT")
SiteTitle = SITEINFO.attributes(1).value
SiteDesc = SITEINFO.attributes(2).value
Cat = CATS.attributes(1).value
Dim COUNTRY
Dim ZIP
Dim STATE
Dim CITY
Dim STREET
STREET = ADDR.attributes(0).value
CITY = ADDR.attributes(1).value
ZIP = ADDR.attributes(2).value
STATE = ADDR.attributes(3).value
COUNTRY = ADDR.attributes(4).value
Dim xDate
Dim xPhone
Dim xOwner
Dim xEmail
Dim xLex
Dim xCode
Dim xLinksin
Dim xSpeed
Dim xPct
Dim xPopularity
Dim xRank
Dim xChild
Dim xReach  
xDate = CREATED.attributes(0).value
xPhone = PHONE.attributes(0).value
xOwner = OWNER.attributes(0).value
xEmail  = EMAIL.attributes(0).value
xLex  = LANG.attributes(0).value
xCode = LANG.attributes(1).value
xLinksin = LINKSIN.attributes(0).value
xSpeed  = SPEED.attributes(0).value
xPct  = SPEED.attributes(1).value
xPopularity = POPULARITY.attributes(1).value
xPopularity = Comma(xPopularity)
xRank = RANK.attributes(0).value
if instr(xRank,"-")>0 then
dimg = ""
else
dimg = ""
end if
xRank = replace(xRank,"+","")
xRank = replace(xRank,"-","")
xRank = Comma(xRank)
xChild = CHILD.attributes(0).value
xReach = REACH.attributes(0).value  
Public Function RemoveHtml(byval strContent)
 Dim objReg ,strTmp
 If strContent="" OR ISNull(strContent) Then Exit Function
  
 Set objReg=new RegExp
 objReg.IgnoreCase =True
 objReg.Global=True
 objReg.Pattern="<(.[^>]*)>"
 strTmp=objReg.Replace(strContent, "")
 Set objReg=Nothing
 RemoveHtml=strTmp
 strTmp=""
End Function
Dim SitePic
Dim pm6,pm3,pm1,pday15,pday7
Dim tmp1
Dim t_arr
Dim t_day,t_wk1,t_m3,t_m3_change
pm6 = "http://traffic.alexa.com/graph?w=700&h=280&r=6m&y=t&u="&Domain
pm3 = "http://traffic.alexa.com/graph?w=700&h=280&r=3m&y=t&u="&Domain
pm1 = "http://traffic.alexa.com/graph?w=700&h=280&r=1m&y=t&u="&Domain
pday15 = "http://traffic.alexa.com/graph?w=700&h=280&r=15.0m&y=t&u="&Domain
pday7 = "http://traffic.alexa.com/graph?w=700&h=280&r=7.0m&y=t&u="&Domain
set tnames = request.cookies("dnames")
if isnull(tnames) or len(trim(tnames))=0 then
 tnames = domain&"|"
else
 if instr(tnames,domain)>0 then
  names = replace(tnames,domain&"|","")
 else
  tnames = domain&"|"&tnames
 end if
end If
ttnames = split(tnames,"|")
tmpncontent = ""
if ubound(ttnames)>5 then
 for tat=0 to 4
  tmpncontent = tmpncontent&ttnames(tat)&"|"
 next
else
 tmpncontent=tnames
end If
response.cookies("dnames") = trim(tmpncontent)
response.cookies("dnames").expires = now()+1
%>

热门栏目