?php //获取网站百度权重搜狗谷歌PR //神龙QQ:29295842 /*获取百度权重*/ functionbaidu_br($s){ $baidu=http://mytool.chinaz.com/baidusort.aspx?host=.$s; $site=file_get_contents($baidu);//file_get_contents(urlencode($baidu)); preg_match_all((font
//获取网站 百度权重 搜狗 谷歌PR
<?php //获取网站 百度权重 搜狗 谷歌PR //神龙 QQ:29295842 /*获取百度权重*/ function baidu_br($s){ $baidu="http://mytool.chinaz.com/baidusort.aspx?host=".$s; $site=file_get_contents($baidu); //file_get_contents(urlencode($baidu)); preg_match_all('(<font color=\"blue\">(.*?)<\/font>)', $site,$count); //print_r($count); if(!empty($count[1][0])) { return $count[1][0]; } else { return "!"; } return $count[1][0]; } /*搜狗 */ function sogo($s){ $sogo="http://rank.ie.sogou.com/sogourank.php?url=".$s; $site=file_get_contents($sogo); preg_match_all('(sogourank=(.*?)$)', $site,$count); if(!empty($count[1][0])) { return $count[1][0]; } else { return "!"; } return $count[1][0]; } /*google*/ function app_hash_url($url){ $seed="Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE."; $result=0x01020345; for($i=0;$i<strlen($url);$i++){ $result^=ord($seed{$i%87})^ord($url{$i}); $result=(($result>>23)&0x1FF)|$result<<9; } return sprintf("8%x",$result); } function get_domain($url){ //获取主域名 //$url = "http://www.uncletoo.com/plug/tags/?tag=PHP"; preg_match('@^(?:http://)?([^/]+)@i', $url, $matches); return $matches[1]; //echo $host; } function google_pr($url){ try { $url=get_domain($url); //获取主域名 //echo $url; $PR_CH=app_hash_url($url); $url='http://toolbarqueries.google.com/tbr?client=navclient-auto&features=Rank&q=info:'.$url.'&ch='.$PR_CH; $prtext=file_get_contents($url); if($prtext!=""){ $pr=explode(":",$prtext); return $pr[2]; }else{ return "!"; } return "!"; } //捕获异常 catch(Exception $e) { return "!"; } } echo "baidu--".baidu_br('http://www.hf97.com/plus/av.php'); echo "sogo--".sogo('http://www.hf97.com/plus/av.php'); echo "google--".google_pr('http://www.hf97.com/plus/av.php'); ?>