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 :


<?php
/*
Combination of PHP Alexa Rank Fetcher Class by David Walsh (http://davidwalsh.name/php-alexa-rank-fetcher-xml)
with
Indonesia DO Follow list at http://jimmykurniaindradjaya.com/2008/06/07/daftar-situs-indonesia-yang-do-follow
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);
$this->set();
}

/* 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('http://alexa.com/xml/dad?url=','rasyid.net'); // domain only!
echo 'Rank :: '.$alexa_connector->get('rank'); // returns 118
*/

$daftar="http://www.brokencode.biz (Alexa Rank:87,044)
http://www.cosaaranda.com (Alexa Rank:89,371)
http://alamsyah.rasyid.net (Alexa Rank:95,365)
http://www.sumintar.com (Alexa Rank:106,792)
http://tipis.web.id (Alexa Rank:107,911)
http://www.blogguebo.com (Alexa Rank:Rank:115,082)
http://koolsonic.com (Alexa Rank:129,292)
http://www.jimmysun.net (Alexa Rank:131,025)
http://www.baladika.info (Alexa Rank:131,104)
http://kombor.com (Alexa Rank:137,472)
http://www.jokosupriyanto.com (Alexa Rank:149,360)
http://www.hitmansystem.com (Alexa Rank:167,126)
http://harry.sufehmi.com (Alexa Rank:168,840)
http://chodirin.or.id (Alexa Rank:173,602)
http://jimmykurniaindradjaya.com (Alexa Rank:176,647)
http://tonijauhari.blogspot.com (Alexa Rank:187,198)
http://www.thefachia.com (Alexa Rank:209,796)
http://www.penulislepas.com (Alexa Rank:246,770)
http://gudangmusik.blogspot.com (Alexa Rank:247,012)
http://www.andaka.com (Alexa Rank:253,415)
http://danu.web.id (Alexa Rank:265,821)
http://fahry.com (Alexa Rank:284,113)
http://kerjakeras.com (Alexa Rank:286,496)
http://malapu-pro.com (Alexa Rank:288,361)
http://brokethesoul.com (Alexa Rank:300,317)
http://harry99.info (Alexa Rank:304,070)
http://www.dewahyoe.org (Alexa Rank:304,259)
http://blog.sampepuas.com (Alexa Rank:324,494)
http://www.dexno.com (Alexa Rank:378,541)
http://rubenmanik.com (Alexa Rank:397,400)
http://oktasihotang.com (Alexa Rank:452,924)
http://www.promobebas.com (Alexa Rank:457,695)
http://idebisnisusaha.com (Alexa Rank:462,530)
http://wawanwae.blogspot.com (Alexa Rank:492,036)
http://www.arhan.web.id (Alexa Rank:510,700)
http://ningtyasindri.blogspot.com (Alexa Rank:580,137)
http://penyuonline.info (Alexa Rank:612,042)
http://dhimas.web.id (Alexa Rank:614,262)
http://semarangreview.blogspot.com (Alexa Rank:632,546)
http://www.vaseppi.com (Alexa Rank:633,166)
http://www.permanaj.net (Alexa Rank:663,932)
http://nichpakaich.net (Alexa Rank:675,980)
http://kolomkesehatan.blogspot.com (Alexa Rank:682,998)
http://danielmginting.blogspot.com (Alexa Rank:685,623)
http://tera.sirumah.com (Alexa Rank:702,038)
http://www.gareng.net (Alexa Rank:730,221)
http://www.tantan-hilyatana.net (Alexa Rank:791,640)
http://www.lutfigoblog.com (Alexa Rank:799,329)
http://bernard-notes.com (Alexa Rank:846,179)
http://andri.andriani.web.id (Alexa Rank:853,393)
http://muhammad.robee.web.id (Alexa Rank:894,265)
http://wanadamsyah.blogspot.com (Alexa Rank:924,819)
http://blog.mriza.web.id (Alexa Rank:961,308)
http://utchanovsky.com (Alexa Rank:998,071)
http://ngkong.net (Alexa Rank:1,108,184)
http://ivan.faderlan.com (Alexa Rank:1,166,573)
http://rehesa.com (Alexa Rank:1,211,048)
http://awan.wibawa.net (Alexa Rank:1,220,173)
http://freewareforall.blogspot.com (Alexa Rank:1,250,975)
http://cariuangtambahan.blogspot.com (Alexa Rank:1,511,850)
http://dhawuh.blogspot.com (Alexa Rank:1,636,655)
http://agusnaim.web.id (Alexa Rank:1,654,871)
http://negerihijau.blogspot.com (Alexa Rank:1,776,961)
http://dhuwuh.blogspot.com (Alexa Rank:1,935,589)
http://www.bintorobisnis.com (Alexa Rank:2,069,878)
http://www.sukseslewatinternet.com (Alexa Rank: 2,116,569)
http://yasrama.blogspot.com (Alexa Rank:2,408,774)
http://www.m4s73r.com (Alexa Rank:2,560,229)
http://kreatifplus.blogspot.com (Alexa Rank:3,156,525)
http://hapebewe.blogspot.com (Alexa Rank:3,366,339)
http://mybluegreen.net (Alexa Rank:3,602,702)
http://nanieku.blogspot.com (Alexa Rank:4,015,186)
http://firta-ku.blogspot.com (Alexa Rank:19,420,182)";

//initial explode

$data=explode("\n",$daftar);

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

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

$link=str_replace('http://','',$link2[0]);
$link=str_replace('www.','',$link);

$alexa_connector = new alexa('http://alexa.com/xml/dad?url=',"$link"); // domain only!
$ranking=$alexa_connector->get('rank');

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.

11 Comments

  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.