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
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;
?>




Thanks for the script I may use it
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!
Thanks for the script I may use it
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!
excellent
i am using this now
Thanks a lot! Great script…
Chris
Thanks for this script! its certainly faster than parsing using the fopen commands. I’m making a widget with this too!
Thank you so much..
I will use that
not work