利用php获取网站的谷歌pr值。
方法如下:
<p>function app_hash_url($url){</p> $seed="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE.";<br /> $result=0x01020345;<br /> for($i=0;$i<strlen($url);$i++){<br /> $result^=ord($seed{$i%87})^ord($url{$i});<br /> $result=(($result>>23)&0x1FF)|$result<<9;<br /> }<br /> return sprintf("8%x",$result);<br /><p>}
php完整获取谷歌pr值的实例如下:
<p>/*php获取网站谷歌pr值完整示例*/</p>$url='www.scutephp.com';<br />function app_hash_url($url){<br /> $seed="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE.";<br /> $result=0x01020345;<br /> for($i=0;$i<strlen($url);$i++){<br /> $result^=ord($seed{$i%87})^ord($url{$i});<br /> $result=(($result>>23)&0x1FF)|$result<<9;<br /> }<br /> return sprintf("8%x",$result);<br />}<br />$PR_CH=app_hash_url($url);<br />$url='http://toolbarqueries.google.com/tbr?client=navclient-auto&features=Rank&q=info:'.$url.'&ch='.$PR_CH;<br />echo file_get_contents($url);