Alexa traffic rank is a value given to any website by alexa based on it’s traffic. A lower traffic rank means higher traffic volume to a website. Alexa is providing an paid API to access it database. But there is a way to do this for free. To get this data in XML format use following URL
To parse this XML file either you can use regular expression match or use inbuilt php5 function simplexml_load_file. here i am doing this with simplexml_load_file
PHP code to get Alexa Rank
<? $url='toolspot.org'; $xml = simplexml_load_file('http://data.alexa.com/data?cli=10&dat=snbamz&url='.$url); $rank=isset($xml->SD->POPULARITY)?$xml->SD->POPULARITY->attributes()->TEXT:0; $web=(string)$xml->SD->attributes()->HOST; echo $web." has Alexa Rank ".$rank; ?>
To get other info like alexa backlinks, website load time, dmoz listing etc, use similar method to parse XML
Eg: To get alexa backlink
Alexa Rank checker Demo
woww its working. Thank you so much
I use wordpress, where I had to put the above code?
you put the code on your website LOL
I’ve made a little script that lets you add the Alexa Rank to a Mysql database.
The script is nothing big. I was wishing to share it in exchange of small donations. The reason I’m asking for donations is because I’m having a little trouble taking care of my household and I’m hoping to go 100% freelancing.
Thank you for being understanding.
Have a wonderful day.
Boooom. WOrking Script Bro Thank You Soo Much.
super its working..
This is great tutorial for getting alexa rank using php .Here is tutorial to get details alexa rank:
Great post, I made an imrpoved version of this and I like to share.
private function getAlexaRank($domain_name = ‘bachecubano.com’)
$xml = simplexml_load_file(‘http://data.alexa.com/data?cli=10&dat=snbamz&url=’ . $domain_name);
$rank = isset($xml->SD->POPULARITY) ? $xml->SD->POPULARITY->attributes()->TEXT : 0;
//$web = (string)$xml->SD->attributes()->HOST;
$reach = isset($xml->SD->POPULARITY) ? $xml->SD->REACH->attributes()->RANK : 0;
$delta = isset($xml->SD->POPULARITY) ? $xml->SD->RANK->attributes()->DELTA : 0;
return [‘rank’ => $rank, ‘reach’ => $reach, ‘delta’ => $delta];
So just call it by var_dump($this->getAlexaRank(‘your_domain_name.com’));
Hi, still can use in 2017?
Yes its still working