Copy CodeThe code is as follows:
/*
* Function: Encode the URL
* Parameter description: $web _url website URL, does not contain "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 >>) & 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;
}
I write the PR query tool is like this, but a little to explain, PR sometimes query a little slow, some people say why other people's station query quickly, in fact, a lot of PR query stations have done a variety of caches, because the PR general situation, will not change, unless Google PR update, hehe.
The above introduces the latest PR-Google PR value algorithm, with PHP query PR value code example, including the PR aspect of the content, I hope that the PHP tutorial interested friends helpful.