php查看pr代码和firefox用书签查询网站pr值
author:一佰互联 2019-05-10   click:165
北京网站建设公司巅云建站:在chrome或者firefox都有pr查询工具,访问某个网页的时候,自动显示当前网站制作的pr值。

但并不是所有的页面都需要查询,于是弄了一个查询pr的书签,仅在需要查询的时候,再点击查询。

附用php的实现pr思路:

<?php
$url = $_GET['url'];
$html_url = htmlspecialchars($url);

function HashURL($url)
{$SEED = "Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE.";
$Result = 0x01020345;
for ($i=0; $i<strlen($url); $i++)
{
$Result ^= ord($SEED{$i%87}) ^ ord($url{$i});
$Result = (($Result >> 23) & 0x1FF) | $Result << 9;
}
return sprintf("8%x", $Result);
}

function pagerank($domain)
{
$StartURL = "http://toolbarqueries.google.com/tbr?client=navclient-auto&features=Rank:&q=info:";
$GoogleURL = $StartURL.$domain. '&ch='.HashURL($domain);
$fcontents = file_get_contents("$GoogleURL");
$pagerank = substr($fcontents,9);
if (!$pagerank) return "0";else return $pagerank;
}

$website = $html_url;
$website = str_replace("http://","",$website);
@ $pr = pagerank("$website");
@ date_default_timezone_set(PRC);
$now_date = date("Y年n月j日 G时i分s秒");
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>PR查询</title>
</head>
<body>
<?php
echo '<p id="pr_info"><b>'.$html_url.'</b> 的PR为 '.$pr.' <a href="http://upload.chinaz.com//"/></a></p><p><span>查询时间:'.$now_date.'</span></p>';
?>
</body>
</html>

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的网址,直接点书签即可:

全文已经结束。

本文发布于北京网站制作公司巅云建站http://www.yinxi.net/