ASP write Alexa ranking Query system tutorial Two

Source: Internet
Author: User
Tags trim

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
%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.