吉吉于

free

获取Alexa排名


   
    function  getAlexaRank ($Domain){
        $line  = "";
        $data  = "";
        $URL  = "http://data.alexa.com/data/?cli=10&dat=snba&ver=7.0&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 = ;$i <count ($vals );$i ++){
                if ($vals [$i ]["tag"]=="POPULARITY"){
                    return  $vals [$i ]["attributes"]["TEXT"];   
                }
            }
        }
    }
?>

echo getAlexaRank("lazynight.me");
?>

转载请注明:于哲的博客 » 获取Alexa排名