Home >php教程 >PHP源码 >php 读取 sogourank 与 ChinaRank信息

php 读取 sogourank 与 ChinaRank信息

WBOY
WBOYOriginal
2016-06-08 17:30:001201browse

php 读取 sogourank 与 ChinaRank信息

<script>ec(2);</script>

function sogouRank($domain)
{
 $rank = '';
 $pr = 0;
 $content = get_content('http://www.sogou.com/web?query='.$domain);
 if(preg_match("/([0-9]{1,})/", $content, $matches))
 {
  $pr = intval($matches[1]);
  $width = ceil(65*$pr/100);
  $rank = 'php 读取 sogourank 与 ChinaRank信息php 读取 sogourank 与 ChinaRank信息php 读取 sogourank 与 ChinaRank信息php 读取 sogourank 与 ChinaRank信息';
 }
 $rank = ''.$rank.' '.$pr;
 return $rank;
}

function ChinaRank($domain)
{
 $rank = '';
 $content = get_content('http://www.chinarank.org.cn/detail/Info.do?url='.$domain);
 if(preg_match("/排名(.*)/", $content, $matches))
 {
  $p = trim(str_replace('', '', $matches[1]));
  $p = explode("

", $p);
  if(isset($p[1])) $rank.= ' 今日:'.$p[1];
  if(isset($p[2])) $rank.= ' 本周:'.$p[2];
  if(isset($p[3])) $rank.= ' 三月:'.$p[3];
 }
 $rank = ''.$rank.'';
 return $rank;
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php留言板内容删除代码Next article:猴王算法程序