首页 > php教程 > php手册 > 正文

获取网站 百度权重 搜狗 谷歌PR

php中文网
发布: 2016-06-06 19:37:00
原创
2648人浏览过

?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
//神龙 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('((.*?))', $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    $result^=ord($seed{$i%87})^ord($url{$i});
    $result=(($result>>23)&0x1FF)|$result  }
  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');
?>
<?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');
?>
登录后复制
相关标签:
谷歌浏览器
谷歌浏览器

谷歌浏览器Google Chrome是一款可让您更快速、轻松且安全地使用网络的浏览器。Google Chrome的设计超级简洁,使用起来得心应手。这里提供了谷歌浏览器纯净安装包,有需要的小伙伴快来保存下载体验吧!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门推荐
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号