我一直在PHP中尝试以下代码来提取alexa网站排名
<?php
$url="http://stackoverflow.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." has Alexa Rank ".$rank;
?>
我不知道出了什么问题。这是输出
SD[1]->POPULARITY)?$xml->SD[1]->POPULARITY->attributes()->TEXT:0; $web=(string)$xml->SD[0]->attributes()->HOST; echo $web." has Alexa Rank ".$rank; ?>
我错过了一些图书馆吗?或者什么?