
 
  文章来源: 
    
      100素材网
  
  更新时间:
    
   2014-08-11 15:22:16
  
  
  Alexa代码php  php读取Alexa代码  php网站Alexa   
     php获取Alexa值方法一:
php获取Alexa值方法二:
	
 
    <?php
/**
 * Alexa Rank with PHP
 * 
 * @param string $domain (www.w3bes.com)
 * @return int || void
 */
function alexa($domain){
  $uri = 'http://data.alexa.com/data?cli=10&dat=snbamz&url=';
  $uri .= $domain;
  $xml = simplexml_load_file($uri);
  if (isset($xml->SD[1]->POPULARITY))
    return (int) $xml->SD[1]->POPULARITY->attributes()->TEXT;
}
echo '100素材网Alexa 排名:'.alexa('100sucai.com');
?>
php获取Alexa值方法二:
<?php
$url="baidu.com";
$xml = simplexml_load_file('http://data.alexa.com/data?cli=10&dat=snbamz&url='.$url);
$rank=isset($xml->SD[1]->POPULARITY)?$xml->SD[1]->POPULARITY->attributes()->TEXT:0;
$web=(string)$xml->SD[0]->attributes()->HOST;
echo $web." Alexa 排名:".$rank;
?>
  浏览次数次 
     上一篇文章: PHP AJAX投票调查代码 
       下一篇文章: JQuery的Ajax跨域请求php代码 
    
                
            
 推荐阅读:
推荐阅读: 
       
       
       
       
       
       
       
      