0
0

用书签查询网站pr值

崔凯 发表于 2012年01月16日 14:55 | Hits: 297

在chrome或者firefox都有pr查询工具,访问某个网页的时候,自动显示当前网站的pr值。
但并不是所有的页面都需要查询,于是弄了一个查询pr的书签,仅在需要查询的时候,再点击查询。

javascript:(function()%7Bvar%20d=document;var%20l=location;var%20u=l.toString();var%20s=d.createElement('script');var%20b='http://uicss.cn/pr/';var%20n=b+'url.php?'+'&url='+encodeURIComponent(u);window.open(n);%7D)();

使用方法:
添加上面的js代码到自己的书签就可以了。在需要查询pr的网址,直接点书签即可:

用书签查询网站pr值

全文已经结束。

附url.php的实现思路:

  1. <?php
  2. $url=$_GET['url'];
  3. $html_url=htmlspecialchars($url);
  4.  
  5. function HashURL($url)
  6. {$SEED="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE.";
  7.    $Result=0x01020345;
  8.    for ($i=0;$i<strlen($url);$i++) 
  9.    {
  10.        $Result^=ord($SEED{$i%87})^ord($url{$i});
  11.        $Result=(($Result>>23)&0x1FF)|$Result<<9;
  12.    }
  13.    return sprintf("8%x",$Result);
  14. }
  15.  
  16. function pagerank($domain)
  17. {   
  18.    $StartURL="http://toolbarqueries.google.com/tbr?client=navclient-auto&features=Rank:&q=info:";
  19.    $GoogleURL=$StartURL.$domain.'&ch='.HashURL($domain);
  20.    $fcontents=file_get_contents("$GoogleURL");
  21.    $pagerank=substr($fcontents,9);
  22.    if (!$pagerank)return"0";elsereturn$pagerank;
  23. }
  24.  
  25. $website=$html_url;
  26. $website=str_replace("http://","",$website);
  27. @$pr=pagerank("$website");
  28. @date_default_timezone_set(PRC);
  29. $now_date=date("Y年n月j日 G时i分s秒");
  30. ?>
  31.  
  32. <!DOCTYPE html>
  33. <html>
  34. <head>
  35. <meta charset="utf-8" />
  36. <title>PR查询</title>
  37. </head>
  38. <body>
  39. <?php
  40. echo '<p id="pr_info"><b>'.$html_url.'</b> 的PR为'.$pr.'<a href="http://uicss.cn/pr/"><img src="primg/1/'.$pr.'.gif"/></a></p><p><span>查询时间:'.$now_date.'</span></p>';
  41. ?>
  42. </body>
  43. </html>

相关日志:

原文链接: http://www.udpwork.com/redirect/6709

0     0

我要给这篇文章打分:

可以不填写评论, 而只是打分. 如果发表评论, 你可以给的分值是-5到+5, 否则, 你只能评-1, +1两种分数. 你的评论可能需要审核.

评价列表(0)