Copy Code code as follows:
/*
* Function: to encode the URL
* Parameter description: $web _url Web site 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 <strlen ($url); $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 site 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" or else return $pagerank;
}
I write the PR query tool is like this, but there is a point to explain, PR sometimes query a bit slow, some people say why other people's station query quickly, in fact, a lot of PR query stations have done a variety of caching, because the general situation of PR, will not change, unless Google PR update, hehe.