获取Alexa排名
18 Dec 2011function 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");
?>