【摘要】 方法一:直接在网页中嵌入代码
把下面这段代码放到你的网页中就可以有pr和alexa 查询了<form action=http://www.pipcn.com/link/?action=search&do=alexa name="form9" target="cmd" method="post"><!--begin 可修改显示样式-->网站信息:<br /><!--Begin:设定默认查询首页。…… 碧森尤信 方法一:直接在网页中嵌入代码
把下面这段代码放到你的网页中就可以有pr和alexa 查询了 <form action=http://www.pipcn.com/link/?action=search&do=alexa name="form9" target="cmd" method="post"> <!--begin 可修改显示样式--> 网站信息:<br /> <!--Begin:设定默认查询首页。下面的 www.pipcn.com/link/ 是可修改默认的查询页面--> http://<input name="url" type="text" size="30" value="/blog/www.pipcn.com/link/"> <!--End 设定默认查询首页--> <br /><input type="submit" value="ALEXA世界排名" onClick="javascript:window.rinfo.innerHTML='Loading...'; form9.action='http://www.pipcn.com/link/?action=search&do=alexa';form9.submit(); " /> <input type="submit" value="Google PR值" onClick="javascript:window.rinfo.innerHTML='Loading...'; form9.action='http://www.pipcn.com/link/?action=search&do=pr';form9.submit(); " /> </form> <!--Begin:结果输出--> <div id="rinfo" name="rinfo" >Loading...</div> <!--End:结果输出--> <!--End 可修改显示样式--> <iframe frameborder=0 height=0 src=http://www.pipcn.com/link/?action=search&do=alexa&url=www.pipcn.com/link/ name="cmd" id="cmd" ></iframe>
效果显示:
方法二:查询pr和查询alexa的ASP函数代码
function getPR(URL) url="http://rankwhere.com/google-page-rank.php?url="&URL wstr=getHTTPPage(url) start=Newstring(wstr,"has Google") over=Newstring(wstr,"NOTE") body=mid(wstr,start+0,over-start-10) body_arr=Split(body," ") Y_MyLink_PR=int(body_arr(3)) getPR=Y_MyLink_PR end function
function getAlexa(URL) url="http://www.alexa.com/data/details/traffic_details?q=&url="&URL wstr=getHTTPPage(url) start=Newstring(wstr, "<!--Did you know? Alexa offers this data programmatically. Visit http://aws.amazon.com/awis for more information about the Alexa Web Information Service.-->") if len(wstr)=start then getAlexa = 9999999 else body=mid(wstr,start-0,1119) over=Newstring(body,"</span>") body=mid(wstr,start-0,over-0) getAlexa = RegExpTest(">[0-9]{1,3}<", body) end if end function
Function getHTTPPage(Path) t = GetBody(Path) getHTTPPage=BytesToBstr(t,"GB2312") End function
Function GetBody(url) on error resume next Set Retrieval = CreateObject("Microsoft.XMLHTTP") With Retrieval .Open "Get", url, False, "", "" .Send GetBody = .ResponseBody End With Set Retrieval = Nothing End Function
Function BytesToBstr(body,Cset) on error resume next dim objstream set objstream = Server.CreateObject("adodb.stream") objstream.Type = 1 objstream.Mode =3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = Cset BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function
Function Newstring(wstr,strng) Newstring=Instr(lcase(wstr),lcase(strng)) if Newstring<=0 then Newstring=Len(wstr) End Function
小结:方法一比较简单,可以直接使用;方法二还需要编写程序代码,稍微有些烦琐,函数功能一目了然,就不解释了,但可以实现更多功能(怎么利用,自己想吧,哈哈)。
本站原创,鄙视转载不注名出处。 本站搜索: alexa pr google 代码 [在Google上搜索相关文章] [在百度上搜索相关文章]
【郑重声明】 本站所有文章除注有来源网址外均为互联网首发,按照 创造共用方式授权,允许相关网站转载,但必须标明作者名称并在明显位置作好原文网址链接(复制以上链接),且不能运用于任何商业目的。 —— 建筑知识引擎小组
|