10:48 am - Thursday February 9, 2012

Get Alexa Rank using Php

  • Share
  • Share

Here is a simple PHP script to get the Alexa Rank of any website. This script can be used to display the Alexa Rank without any widget or plugin.

Some people tend to enter the Alexa Rank in About Us page, but since the rank keeps changing they got to update it often, I see some sites in Blogosphere where people hardly edit the Alexa Rank, such cases, this PHP script can dynamically generate the accurate present Alexa Rank

alexa php Get Alexa Rank using Php

Alexa Rank using PHP

PHP Code for Alexa Rank

<?php
$url = ‘bytechip.com’;
$new_url = ‘http://www.alexa.com/siteinfo/’.$url;
$contents=file_get_contents($new_url);

/* This will find the Global Alexa Rank */
$start = strpos($contents, “<div class=”data up”>”) +119;
$stop= strpos($contents,”<div class=”label”>Alexa Traffic Rank”);
$result = substr($contents,$start,$stop-$start);
echo “Global Alexa Rank for “.$url.” = “.$result;
?>

moz screenshot Get Alexa Rank using Php

Download Alexa Rank PHP Script:

http://rapidshare.com/files/379534454/alexa.php.html
pixel Get Alexa Rank using Php

Loading
Filed in: Web

9 Responses to “Get Alexa Rank using Php”

  1. April 26, 2010 at 8:43 am #

    Thanks for the script I may use it

  2. April 26, 2010 at 9:02 am #

    Just what i wanted! I hate to see the old Alexa widget which even doesn't get updated correctly! Hope i can make a better one from your script! :D

  3. April 26, 2010 at 2:13 pm #

    Thanks for the script I may use it

  4. April 26, 2010 at 2:32 pm #

    Just what i wanted! I hate to see the old Alexa widget which even doesn't get updated correctly! Hope i can make a better one from your script! :D

  5. June 8, 2010 at 2:56 pm #

    excellent :) i am using this now

  6. August 19, 2010 at 8:32 pm #

    Thanks a lot! Great script…
    Chris

  7. September 11, 2010 at 8:09 am #

    Thanks for this script! its certainly faster than parsing using the fopen commands. I’m making a widget with this too!

  8. February 16, 2011 at 3:55 am #

    Thank you so much..
    I will use that

  9. Ebrahim Alizadeh
    June 20, 2011 at 2:39 pm #

    not work :(

Leave a Reply