Home > php教程 > php手册 > 用书签查询网站pr值

用书签查询网站pr值

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-21 08:52:08
Original
952 people have browsed it

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

  

 

  全文已经结束。

  附url.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     {
        $Result ^= ord($SEED{$i%87}) ^ ord($url{$i});
        $Result = (($Result >> 23) & 0x1FF) $Result     }
    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秒");
?>
 




PR查询


echo '

'.$html_url.' 的PR为 '.$pr.' http://uicss.cn/pr/">用书签查询网站pr值 src=http://www.php100.com/html/webkaifa/PHP/PHPyingyong/2012/0117/"primg/1/'.$pr.'.gif"/>

查询时间:'.$now_date.'

';
?>



Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template