Copy code The code is as follows:
/*
*Function: Encode URL
*Parameter description: $web_url Website URL, excluding "http://", such as jb51.net
*/
function HashURL($url){
$SEED = "Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I 'm talking to you, scammer.";
$Result = 0x01020345;
for ($i=0; $i{
$Result ^ = ord($SEED{$i%87}) ^ ord($url{$i});
$Result = (($Result >> 23) & 0x1FF) | $Result << 9 ;
}
return sprintf("8%x", $Result);
}
/*
*Function: Get pagerank
*Parameter description: $domain website domain name, Does not contain "http://",
*/
function pagerank($domain)
{
$StartURL = "http://toolbarqueries.google.com/tbr?client=navclient- auto&features=Rank:&q=info:";
// $StartURL = "http://www.google.com/search?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;
}
The PR query tool I wrote is like this, but there is one thing to note, PR sometimes The query is a bit slow. Some people ask why other people's sites query so quickly. In fact, many PR query sites have done various caches, because PR generally does not change unless Google PR updates, haha.
http://www.bkjia.com/PHPjc/324848.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324848.htmlTechArticleCopy code The code is as follows: /* *Function: Encode URL *Parameter description: $web_url Website URL, no Contains "http://", such as jb51.net */ function HashURL($url){ $SEED = "Mining PageRank is...