Reputation: 581
I want to get country wise alexa ranking of a specific website using PHP or JAVASCRIPT.
Can anyone help me?
Upvotes: 2
Views: 2198
Reputation: 305
<?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";
?>
The result will be
google.com.sg has Alexa Rank 282 and Country Rank 2.
Adapted from here
Upvotes: 2
Reputation: 111
You can use this http://aws.amazon.com/code/AWIS/402
The UrlInfo has a Response Group called RankByCountry that should solve your purpose. Find details here: http://docs.aws.amazon.com/AlexaWebInfoService/latest/
Upvotes: 1