i漂泊

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3739|回复: 0

php获取网站谷歌pr值方法 方法三

[复制链接]
TA的礼物信息
  • 收到:0
  • 送出:2
发表于 2013-3-18 21:22:05 | 显示全部楼层 |阅读模式
利用php获取网站的谷歌pr值,网址请求谷歌api的URL地址为:

http://toolbarqueries.google.com ... es=Rank&q=info:www.phpernote.com&ch=8a1467f12
  1. /*php获取网站谷歌pr值完整示例*/
  2. 02
  3. $url='www.phpernote.com';
  4. 03
  5. function app_hash_url($url){
  6. 04
  7.     $seed="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE.";
  8. 05
  9.     $result=0x01020345;
  10. 06
  11.     for($i=0;$i<strlen($url);$i++){
  12. 07
  13.         $result^=ord($seed{$i%87})^ord($url{$i});
  14. 08
  15.         $result=(($result>>23)&0x1FF)|$result<<9;
  16. 09
  17.     }
  18. 10
  19.     return sprintf("8%x",$result);
  20. 11
  21. }
  22. 12
  23. $PR_CH=app_hash_url($url);
  24. 13
  25. $url='http://toolbarqueries.google.com/tbr?client=navclient-auto&features=Rank&q=info:'.$url.'&ch='.$PR_CH;
  26. 14
  27. echo file_get_contents($url);
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|IPiaoBo Inc. ( 渝ICP备17002826号 )

GMT+8, 2024-5-5 23:38 , Processed in 0.063541 second(s), 47 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表