Get Alexa Rank with Php to Update DO Follow Blog List

Maintain list of do follow blog isn’t easy specially when you need to keep it up to date. Recent alexa update make me think. How to update the list with minimal effort icon smile Get Alexa Rank with Php to Update DO Follow Blog List

After googling for alexa rank script finally I found interesting php class written by David Walsh. Combine his class with existing do follow blog list by Jimmy Kurnia Indradjaya for this php code :

Combination of PHP Alexa Rank Fetcher Class by David Walsh (
Indonesia DO Follow list at
to keep up to date list
written by Alamsyah Rasyid (September 14 2008)

/* the alexa rank class */
class alexa
/* initial vars */
var $xml;
var $values;
var $alexa_address;

/* the constructor */
function alexa($alexa_address,$domain)
$this->alexa_address = $alexa_address;
$this->xml = $this->get_data($domain);

/* gets the xml data from Alexa */
function get_data($domain)
$url = $this->alexa_address.'http://'.$domain;
$xml = simplexml_load_file($url) or die('Cannot retrieve feed');
return $xml;

/* set values in the XML that we want */
function set()
$this->values['rank'] = ($this->xml->SD->POPULARITY['TEXT'] ? number_format($this->xml->SD->POPULARITY['TEXT']) : 0);
$this->values['reach'] = ($this->xml->SD->REACH['RANK'] ? number_format($this->xml->SD->REACH['RANK']) : 0);
$this->values['linksin'] = ($this->xml->SD->LINKSIN['NUM'] ? number_format($this->xml->SD->LINKSIN['NUM']) : 0);

/* returns the requested value */
function get($value)
return (isset($this->values[$value]) ? $this->values[$value] : '"'.$value.'" does not exist.');

/* retrieve & display rank */

$alexa_connector = new alexa('',''); // domain only!
echo 'Rank :: '.$alexa_connector->get('rank'); // returns 118

$daftar=" (Alexa Rank:87,044) (Alexa Rank:89,371) (Alexa Rank:95,365) (Alexa Rank:106,792) (Alexa Rank:107,911) (Alexa Rank:Rank:115,082) (Alexa Rank:129,292) (Alexa Rank:131,025) (Alexa Rank:131,104) (Alexa Rank:137,472) (Alexa Rank:149,360) (Alexa Rank:167,126) (Alexa Rank:168,840) (Alexa Rank:173,602) (Alexa Rank:176,647) (Alexa Rank:187,198) (Alexa Rank:209,796) (Alexa Rank:246,770) (Alexa Rank:247,012) (Alexa Rank:253,415) (Alexa Rank:265,821) (Alexa Rank:284,113) (Alexa Rank:286,496) (Alexa Rank:288,361) (Alexa Rank:300,317) (Alexa Rank:304,070) (Alexa Rank:304,259) (Alexa Rank:324,494) (Alexa Rank:378,541) (Alexa Rank:397,400) (Alexa Rank:452,924) (Alexa Rank:457,695) (Alexa Rank:462,530) (Alexa Rank:492,036) (Alexa Rank:510,700) (Alexa Rank:580,137) (Alexa Rank:612,042) (Alexa Rank:614,262) (Alexa Rank:632,546) (Alexa Rank:633,166) (Alexa Rank:663,932) (Alexa Rank:675,980) (Alexa Rank:682,998) (Alexa Rank:685,623) (Alexa Rank:702,038) (Alexa Rank:730,221) (Alexa Rank:791,640) (Alexa Rank:799,329) (Alexa Rank:846,179) (Alexa Rank:853,393) (Alexa Rank:894,265) (Alexa Rank:924,819) (Alexa Rank:961,308) (Alexa Rank:998,071) (Alexa Rank:1,108,184) (Alexa Rank:1,166,573) (Alexa Rank:1,211,048) (Alexa Rank:1,220,173) (Alexa Rank:1,250,975) (Alexa Rank:1,511,850) (Alexa Rank:1,636,655) (Alexa Rank:1,654,871) (Alexa Rank:1,776,961) (Alexa Rank:1,935,589) (Alexa Rank:2,069,878) (Alexa Rank: 2,116,569) (Alexa Rank:2,408,774) (Alexa Rank:2,560,229) (Alexa Rank:3,156,525) (Alexa Rank:3,366,339) (Alexa Rank:3,602,702) (Alexa Rank:4,015,186) (Alexa Rank:19,420,182)";

//initial explode


//for($i=0;$i<5;$i++){ // testing top 5 datas only

$link2=explode(' ',$data[$i]);


$alexa_connector = new alexa('',"$link"); // domain only!

echo ($i+1).". <a target=\"_blank\" href=\"$link2[0]\">$link2[0] ( Alexa Rangking : $ranking)</a><br>";



Click here for zip file.

Just make sure simplexml extension loaded to use the class and if you prefer to use CURL you can refer David Walsh post.


  1. Do Follow blogs make the world go round. Web masters willing to give others following links for a comment are really the good sorts!

  2. terima kasih utk infonya, saya sudah menerapkan hasilnya, dan lumayan gak sia-sia. yuk liat sendiri hasilnya di blog ini :D

Comments are closed.