Google PR value to get Google PR value of PHP code

Source: Internet
Author: User
Today, after the update blog program, suddenly found that Google Toolbar PR bar added a little, but has been the Google Toolbar PR because of the buffer problem, so that the current display of the PR value is not necessarily the current page PR value, so to check the next, found blog site (HTTP/ mlsx.xplore.cn/) PR value rose to 3, but the home page (http://mlsx.xplore.cn) is still 2. Rattling, celebrate.
But Glemir this morning told me his blog early has reached 3, so I am a little jealous, and associated with the Rachel Blog, they update are not I diligent, but their PR basically do not need me poor. So I came to two self-comforting conclusions:
1) Rachel PR is the same as mine, because his travels log is popular, I do not have his handwriting.
2) Glemir PR rose faster than mine, that is because he used a good blog program--wordpress
Haha, laugh at yourself.
Turn to the point, affixed to get Google PR value code, the statement is not I write, just modify, checksum algorithm temporarily still do not know.
Demo Code click here

Copy the Code code as follows:


Define (' Google_magic ', 0xe6359a60);
function Zerofill ($a, $b)
{
$z = Hexdec (80000000);
if ($z & $a)
{
$a = ($a >>1);
$a &= (~ $z);
$a |= 0x40000000;
$a = ($a >> ($b-1));
}
Else
{
$a = ($a >> $b);
}
return $a;
}
function Mix ($a, $b, $c)
{
$a-= $b; $a-= $c; $a ^= (Zerofill ($c, 13));
$b-= $c; $b-= $a; $b ^= ($a <<8);
$c-= $a; $c-= $b; $c ^= (Zerofill ($b, 13));
$a-= $b; $a-= $c; $a ^= (Zerofill ($c, 12));
$b-= $c; $b-= $a; $b ^= ($a <<16);
$c-= $a; $c-= $b; $c ^= (Zerofill ($b, 5));
$a-= $b; $a-= $c; $a ^= (Zerofill ($c, 3));
$b-= $c; $b-= $a; $b ^= ($a <<10);
$c-= $a; $c-= $b; $c ^= (Zerofill ($b, 15));
Return Array ($a, $b, $c);
}
function Googlech ($url, $length =null, $init =google_magic)
{
if (Is_null ($length))
{
$length = sizeof ($url);
}
$a = $b = 0X9E3779B9;
$c = $init;
$k = 0;
$len = $length;
while ($len >= 12)
{
$a + = ($url [$k +0] + ($url [$k +1]<<8) + ($url [$k +2]<<16) + ($url [$k +3]<<24));
$b + = ($url [$k +4] + ($url [$k +5]<<8) + ($url [$k +6]<<16) + ($url [$k +7]<<24));
$c + = ($url [$k +8] + ($url [$k +9]<<8) + ($url [$k +10]<<16) + ($url [$k +11]<<24));
$mix = Mix ($a, $b, $c);
$a = $mix [0]; $b = $mix [1]; $c = $mix [2];
$k + = 12;
$len-= 12;
}
$c + = $length;
Switch ($len)
{
Case one: $c + = ($url [$k +10]<<24);
Case: $c + = ($url [$k +9]<<16);
Case 9: $c + = ($url [$k +8]<<8);
Case 8: $b + = ($url [$k +7]<<24);
Case 7: $b + = ($url [$k +6]<<16);
Case 6: $b + = ($url [$k +5]<<8);
Case 5: $b + = ($url [$k +4]);
Case 4: $a + = ($url [$k +3]<<24);
Case 3: $a + = ($url [$k +2]<<16);
Case 2: $a + = ($url [$k +1]<<8);
Case 1: $a + = ($url [$k +0]);
}
$mix = Mix ($a, $b, $c);
return $mix [2];
}
function Strord ($string) {
for ($i =0; $i $result [$i] = Ord ($string {$i});
}
return $result;
}
function READPR ($link)
{
$fp = Fsockopen ("www.google.com", $errno, $errstr, 30);
if (! $fp)
{
echo "$errstr ($errno) \ n";
Exit (1);
}
Else
{
$out = "GET $link http/1.0\r\n";
$out. = "host:toolbarqueries.google.com\r\n";
$out. = "user-agent:mozilla/4.0 (compatible; Googletoolbar 2.0.114.9-big; Linux 2.6) \ r \ n ";
$out. = "connection:close\r\n\r\n";
Fwrite ($fp, $out);
do{
$line = fgets ($fp, 128);
}while ($line!== "\ r \ n");
$data = Fread ($fp, 8192);
Fclose ($FP);
return $data;
}
}
function Getpr ($url)
{
$url = ' info: '. $url;
$ch = Googlech (Strord ($url));
$data = READPR ("/search?client=navclient-auto&ch=6$ch&features=rank&q= $url");
$rankarray = Explode (': ', $data);
return $rankarray [2];
}
if (isset ($_post[' url ')) && $_post[' url ']!== ')
{
Echo ' PageRank: '. GETPR ($_post[' url ');
}
?>
<title>Google PR Value Query</title>
Google PR Value query get source code

The above on the Google PR value to get Google PR value of the PHP code, including the Google PR value of the content, I hope that the PHP tutorial interested friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.