日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

怎樣用asp程序讀取網(wǎng)站的alexa世界排名_ASP教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:怎樣做到一個網(wǎng)站空間多個域名訪問
一個網(wǎng)站空間,但是卻可以實現(xiàn)多個域名的訪問的一段ASP代碼: 以下為引用的內(nèi)容: % if Request.ServerVariables(SERVER_NAME)=&q

平時每逢alexa排名更新時,我都需要將所有相關(guān)的同類網(wǎng)站的排名整理一下,看一下這些對手網(wǎng)站的排名更新情況。做的多了,也就煩了,雖然也才30多個網(wǎng)站,但一個個看下來也有點累。因此,想能不能用程序來讀取他的排名數(shù)據(jù)。

以前記得在什么網(wǎng)址大全的網(wǎng)站上,一個網(wǎng)站名稱后面還有這個網(wǎng)站的世界排名,相信肯定是用程序讀取的,不然要是一個個查非累死不可。但是瀏覽遍了alexa的網(wǎng)站,也沒有找到能夠直接得到排名數(shù)據(jù)的方法。雖然它提供了一些代碼,如:,但是圖片的數(shù)字就沒辦法讀取到了。

后來想要不用xmlhttp讀它頁面,然后截取出那段數(shù)字?麻煩是麻煩點,也許可以一試。于是開始查看顯示排名的那兩頁,

以下為引用的內(nèi)容:

http://www.alexa.com/data/details/@url=www.itlearner.com 和 http://www.alexa.com/data/details/traffic_details@q=!amp;url=www.itlearner.com,查看源文件,搜索"traffic rank for",搜到我網(wǎng)站的排名是這樣一段代碼:<ti><bbip><traffic><today>4</today></traffic></bbip></ti>5<tprp><pyp><page views rank:><pyp>,</pyp></page views rank:></pyp></tprp><today>7</today><page views per user:><[email protected]><today>6</today></[email protected]></page views per user:><[email protected]><traffic rank for>1</traffic rank for></[email protected]>,撲通,看得這段代碼都大了,再找了一下,看到在顯示traffic rank:today 1 wk. avg. 3 mos. avg. 3 mos. change那邊,前面today和1wk都是用上面那種形式表示的,而到了3 mos也就是最關(guān)鍵的數(shù)據(jù)那邊,確是直接用數(shù)字顯示的,太好了!

分析了一下前后的代碼,發(fā)現(xiàn)數(shù)據(jù)后面的</td><td class="bodybold" align="center" bgcolor="#ffffff"><img這段代碼是唯一的,于是開始編程工作。

下面的源代碼示例,供大家參考:

以下為引用的內(nèi)容:

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

以上是讀取alexa網(wǎng)站頁面,對代碼進行分析然后得到排名的數(shù)據(jù)

以下為引用的內(nèi)容:

  dim url url="www.itlearner.com" 要查詢的網(wǎng)址,不要加http:// response.write(getalexarank2(url)) 輸出排名數(shù)據(jù)

  %>

嘿嘿,以后公司的相關(guān)網(wǎng)站排名,就不用再一個一個去查了,只需要把那些網(wǎng)站依此放在程序里,就可以讓程序一個一個的讀出來了。

分享:怎樣隱藏圖片的真實地址
一般情況下,網(wǎng)站的圖片代碼是這樣的。 以下為引用的內(nèi)容: img src=./attachments/test.jpg />

來源:模板無憂//所屬分類:ASP教程/更新時間:2009-05-25
相關(guān)ASP教程