php获取网站谷歌pr值方法
程序员文章站
2022-03-31 17:01:21
...
利用php获取网站的谷歌pr值。
方法如下:
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 }
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 }
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);