我想使用 PHP 或 JAVASCRIPT 获得特定网站的国家/地区Alexa排名。
谁能帮我?
<?php
$url='google.com.sg';
$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;
$country_rank=isset($xml->SD[1]->COUNTRY)?$xml->SD[1]->COUNTRY->attributes()->RANK:0;
$web=(string)$xml->SD[0]->attributes()->HOST;
echo $web." has Alexa Rank ".$rank." and Country Rank ".$country_rank.".\n";
?>
结果将是
google.com.sg 的 Alexa 排名 282 和国家排名 2。
改编自这里
您可以使用此http://aws.amazon.com/code/AWIS/402
UrlInfo 有一个名为 RankByCountry 的响应组,应该可以解决您的目的。在此处查找详细信息:http: //docs.aws.amazon.com/AlexaWebInfoService/latest/