The latest algorithm for obtaining Google PR value using PHP, with a PHP query PR value code example_PHP tutorial

WBOY
Release: 2016-07-21 15:21:38
Original
727 people have browsed it

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.

www.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...
source:php.cn
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!