You are currently browsing the monthly archive for April 2007.

Today one of my internet friend share with us a php code to fetch alexa ranking.

  • All you need to do copy the code from here.
    <?php
    $Url = $_GET[‘url’];
    function getPage ($url) {
    if (function_exists(‘curl_init’)) {
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER[‘HTTP_USER_AGENT’]);
    return curl_exec($ch);
    } else {
    return file_get_contents($url);
    }
    }
    function getAlexaRank($url) {
    $url = @parse_url($url);
    $url = $url[‘host’];
    $url = “http://data.alexa.com/data?cli=10&dat=s&url=$url&#8221;;
    $data = getPage($url);
    preg_match(‘#<POPULARITY URL=”(.*?)” TEXT=”([0-9]+){1,}”/>#si’, $data, $p);
    $value = ($p[2]) ? number_format($p[2]) : 0;
    return $value;
    }
    $Rank = getAlexaRank($Url);
    echo $Rank;
    ?>
  • Save the file in your site http://www.yourdomain.com/alexapagerank.php
  • Now run the file from browser http://www.yourdomain.com/alexapagerank.php?url=domain_name_to_get_alexa_ranking

Easy and simple step to get any of your website alexa ranking from your site.
Thanks to share this valuable code -NB-

While checking my gmail id today, I was shocked to see that google had deactivated my account without any prior notice. Now, I am not able to access my blogger account, orkut account, adsense account and analytics account. It is Google monopoly.Whatever Google is thinking they are doing. They misusing user. I say they are not only misusing they are stealing our resources. Here is the screen shot the message is displaying while login My gmail

So my question is Google safe? From now I can’t trust on Google.