Home >php教程 >PHP源码 >php 读取 alexa信息

php 读取 alexa信息

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:30:011147browse

php 读取 alexa信息

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

function Alexa($domain)
{
 $alexa = '';
 $content = get_content('http://www.alexa.com/data/details/traffic_details?url='.$domain);
 if(preg_match("/3 mos. Change([sS]*?)/", $content, $matches))
 {
  $change = strpos($matches[1], 'down_arrow.gif') ? '下降' : '上升';
  $p = strip_tags($matches[1], '

');
  $p = trim(str_replace(array(" ", "n", ""), array('', '', ''), $p));
  $p = explode("", $p);
  if(isset($p[1])) $alexa.= ' 今日:'.$p[1];
  if(isset($p[2])) $alexa.= ' 本周:'.$p[2];
  if(isset($p[3])) $alexa.= ' 本月:'.$p[3];
  if(isset($p[4])) $alexa.= ' '.$change.':'.$p[4];
 }
 if(preg_match("/Review for $domain: (.*)
/", $content, $matches))
 {
  $alexa = $alexa.' 等级:'.$matches[1];
 }
 $alexa = ''.$alexa.'';
 return $alexa;
}
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