时间:2021-07-01 10:21:17 帮助过:22人阅读
方法如下:
function app_hash_url($url){
$seed="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE.";
$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);}
php完整获取谷歌pr值的实例如下:
/*php获取网站谷歌pr值完整示例*/
$url='www.scutephp.com';
function app_hash_url($url){
$seed="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE.";
$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);
}
$PR_CH=app_hash_url($url);
$url='http://toolbarqueries.google.com/tbr?client=navclient-auto&features=Rank&q=info:'.$url.'&ch='.$PR_CH;
echo file_get_contents($url);