获得Google PR值的PHP代码
今天更新blog程序后,突然发现google工具条上的PR条增加了一点,不过一直以来Google工具条上的PR因为缓冲问题,使得当前显示的PR值并不一定是目前页面的PR值,因此去查了下,发现blog站点(http://mlsx.xplore.cn/)的PR值上升到了3,但是首页 (http://mlsx.xplore.cn)还是2。霍霍,庆贺一下。
不过glemir今天上午告诉我他的blog早已经到了3,使我有点嫉妒,连带想起了Rachel的blog ,他们更新都没有我勤快,但是他们的PR基本上不必我差。由此我得出两个自我安慰的结论:
1)Rachel的PR和我的一样,是因为他的游记日志受欢迎,我没有他的手笔。
2)glemir的PR升的比我的快,那是因为他用了一个好blog程序--wordpress
哈哈,自嘲一下。
转入正题,贴上获得Google的PR值代码,声明不是我写的,只是修改,checksum的算法暂时还不知道。
演示代码点击这里
复制代码 代码如下:
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$c -= $a; $c -= $b; $c ^= (zeroFill($b,13));
$a -= $b; $a -= $c; $a ^= (zeroFill($c,12));
$b -= $c; $b -= $a; $b ^= ($a$c -= $a; $c -= $b; $c ^= (zeroFill($b,5));
$a -= $b; $a -= $c; $a ^= (zeroFill($c,3));
$b -= $c; $b -= $a; $b ^= ($a$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]$b += ($url[$k+4] +($url[$k+5]$c += ($url[$k+8] +($url[$k+9]$mix = mix($a,$b,$c);
$a = $mix[0]; $b = $mix[1]; $c = $mix[2];
$k += 12;
$len -= 12;
}
$c += $length;
switch($len)
{
case 11: $c+=($url[$k+10]case 10: $c+=($url[$k+9]case 9 : $c+=($url[$k+8]case 8 : $b+=($url[$k+7]case 7 : $b+=($url[$k+6]case 6 : $b+=($url[$k+5]case 5 : $b+=($url[$k+4]);
case 4 : $a+=($url[$k+3]case 3 : $a+=($url[$k+2]case 2 : $a+=($url[$k+1]case 1 : $a+=($url[$k+0]);
}
$mix = mix($a,$b,$c);
return $mix[2];
}
function strord($string) {
for($i=0;$i
}
return $result;
}
function ReadPR($link)
{
$fp = fsockopen ("www.google.com", 80, $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']);
}
?>
Google PR值查询 获取源代码

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Efficiently build data query tools: Framework selection for simplifying the development process Product manager proposed a requirement to quickly build a data query tool, which requires...

Safely handle functions and regular expressions in JSON In front-end development, JavaScript is often required...

Is Kotlin worth learning? Does Android development require Kotlin? Many Android developers will have questions when using Java for development: Kotlin language...

How to implement conditional control in the code to avoid unnecessary input operations? During the programming process, sometimes we need to control the code based on certain conditions...

Key considerations and implementation steps for migrating data from local special projects to a unified construction system When local special projects need to migrate data to a unified construction system...

This article summarizes the information of the top ten virtual currency trading apps including Binance, Ouyi and Sesame Open Door, but for security reasons, the URL is not provided directly. Instead, it emphasizes the importance of safe access to the official platform through trusted channels and provides verification methods. At the same time, the article reminds investors to consider factors such as security, transaction fees, currency selection when choosing an APP, and pay attention to the risks of virtual currency trading.

The top ten leading virtual currency trading apps in the world in 2025 are: 1. Binance, 2. Gate.io, 3. OKX, 4. Huobi Global, 5. Bybit, 6. Kraken, 7. FTX, 8. KuCoin, 9. Coinbase, 10. Crypto.com.

The world's leading ten digital currency apps include: 1. OKX, 2. Binance, 3. Huobi, 4. Matcha (MXC), 5. Bitget, 6. BitMEX, 7. Pionex, 8. Deribit, 9. Bybit, 10. Kraken. These platforms have their own characteristics in security, transaction services, technical architecture, risk control team, user experience and ecosystem.
