Alexa is a company owned by Amazon.com that measures web traffic on almost every website on the internet through their toolbar plugin. The Alexa Ranking is a ranking that is based on the traffic to a website. This ranking becomes an important thing in leveraging your website as a sell point to advertisers, sponsors, buyers, readers and whoever else wants a piece of your material. Therefore for some website owners itâs important to put alexa rank in their page.
If you want to put alexa rank in your page, here is the code:
<?php
Class Alexa {
function getAlexaRank($domain)
{
$remote_url = âhttp://data.alexa.com/data?cli=10&dat=snbamz&url=â . trim($domain);
$xml = simplexml_load_file($remote_url);
if(isset($xml->SD[1]->POPULARITY['TEXT'])){
return number_format($xml->SD[1]->POPULARITY['TEXT']);
} else {
return 0;
}
}
}
?>
and
$alexa = new Alexa;
$alexarank = $alexa->getAlexaRank($domain);
echo âAlexa Rank: â . $alexarank;
where $domain is your domain name.
ps: I got this script while googling, unfortunately I forgot the source.
Be First To Comment
Related Post
Leave Your Comments Below