where exactly do i paste this code in?
If you don't have Alexa toolbar i'm sure you have seen somewhere a rank according to it, for example on BuySellAds etc... The traffic rank is based on three months of aggregated historical traffic data from millions of Alexa Toolbar users and data obtained from other, diverse traffic data sources, and is a combined measure of page views and users (reach).
So if you need it for some professional services or dunno just for fun (like me, so far) here's the code for it ready for copy/paste and just change the url.
<? class alexa { var $xml; var $values; var $alexa_address; function alexa($alexa_address,$domain) { $this->alexa_address = $alexa_address; $this->xml = $this->get_data($domain); $this->set(); } function get_data($domain) { $url = $this->alexa_address.'http://'.$domain; $xml = simplexml_load_file($url) or die('Cannot retrieve feed'); return $xml; } function set() { $this->values['rank'] = ($this->xml->SD->POPULARITY['TEXT'] ? number_format($this->xml->SD->POPULARITY['TEXT']) : 0); } function get($value) { return (isset($this->values[$value]) ? $this->values[$value] : '"'.$value.'" does not exist.'); } } $domain = "stylizedweb.com"; $alexa_connector = new alexa('http://alexa.com/xml/dad?url=',$domain); echo 'alexa rank for '.$domain.' is '.$alexa_connector->get('rank'); ?>
where exactly do i paste this code in?
Great information, thanks for sharing it with us. i will try it out for my newly kids portal http://www.buzziboy.com
NICE ![]()
Thanks for the link, i didn’t know who’s the original author
At least give credit where credits due.
change the variable field by :
$domain = $_SERVER[’SERVER_NAME’];
Very useful.
Thanks!
Nice ![]()
very interesting, i always wondered how to do that!
on September 4, 2008
nevermind i figured it out, thanks