CopyCode The Code is as follows :/*
* Function: encode the URL
* Parameter description: $ web_url URL, which does not contain "http: //", for example, 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> 23) & 0x1ff) | $ result <9;
}
Return sprintf ("8% X", $ result );
}
/*
* Function: Obtain PageRank
* Parameter description: $ domain website domain name, excluding "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 it should be noted that PR queries are sometimes slow, and some people say why others' sites query quickly. In fact, many PR query sites have implemented various caches, because PR usually does not change unless Google PR is updated.