HLJ 发布于
2018-12-13 10:52:51
46阅读

php获取网站alexa世界流量排名代码

<?php
function getAlexaRank ($Domain){
     $line = "";
     $data = "";
     $URL = "http://data.alexa.com/data/?cli=10&dat=snba&url=". $Domain ;
     $fp = fopen ($URL ,"r");
     if ($fp ){
           while (!feof ($fp )){
                $line = fgets ($fp );
                $data .= $line ;
           }
           $p= xml_parser_create ();
           xml_parse_into_struct ($p , $data , $vals );
           xml_parser_free ($p );
           for ($i =0 ;$i <count ($vals );$i ++){
  if ($vals [$i ]["tag"]=="POPULARITY"){
      return  $vals [$i ]["attributes"]["TEXT"];
  }
    }
      }
}
 echo getAlexaRank("www.100sucai.com");
?>
当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2018-12-13/307.html
最后生成于 2024-06-22 12:04:24
此内容有帮助 ?
0