Fetch Alexa Rank Using PHP Script



We all know alexa is one of the very popular tool to check website popularity by their rank, It’s traffic rank depends on varies factors, Alexa has given a open url to get some of your’s website traffic data like global and country specific rank, Alexa also provide a paid API to fetch deep analysis of any websites traffic.

For those website owners who do not make the website to make money on the internet, then the Alexa rank is not very useful. However, although useless, sometimes alexa rank became a prestige, because if alexa rank is good then should be said of the website or blog is a popular blog.

Unlike the web owner who makes his web as a place to make money on the internet, alexa rank is very important. Why is it important? Because the places to make money on the internet such as Advertisements makes Alexa rank as a benchmark. The better alexa rank you have, it will be flocking also the advertisers who want to advertise on your website.

Below is the script I used to fetch Alexa Rank, just replace YOU_WEBSITE_HERE with your own domain.

                  <?php
                    function alexa($domain,$format = FALSE){
                      $uri = 'http://data.alexa.com/data?cli=10&dat=snbamz&url=';
                      $uri .= $domain;                    
                      $xml = simplexml_load_file($uri);                    
                      if (isset($xml->SD[1]->POPULARITY))
                        $data = (int) $xml->SD[1]->POPULARITY->attributes()->TEXT;
                        if($format) return number_format($data);
                        return $data;                    
                    }                    
                    // usage
                    echo alexa('
YOU_WEBSITE_HERE',TRUE);
                    // return 1,234,567
                    ?>





Post a Comment

0 Comments