Maison  >  Article  >  php教程  >  php 读取 alexa信息

php 读取 alexa信息

WBOY
WBOYoriginal
2016-06-08 17:30:011064parcourir

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;
}
Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Article précédent:php自治简单留言板代码Article suivant:php 取得客户真实IP地址