Saturday, August 20, 2011

PHP Function to Get Alexa Traffic Rank

To get the Alexa Traffic Rank is very informative to show in your Back office Interface or Admin Panel dashboard to know website traffic details instantly. Most of the clients are request to show Alexa Rank on Admin Panel here is the Script to get Alexa Traffic Rank.

Function to get Alexa Rank.


function alexaRank($domain){
    $remote_url = ''.trim($domain);
    $search_for = '<POPULARITY URL';
 $part = NULL;
    if ($handle = @fopen($remote_url, "r")) {
        while (!feof($handle)) {
            $part .= fread($handle, 100);
            $pos = strpos($part, $search_for);
            if ($pos === false)
        $part .= fread($handle, 100);
    $str = explode($search_for, $part);
    $str = @array_shift(explode('" SOURCE="panel"/>', $str[1]));
    $str = explode('TEXT="', $str);

    return $str[1];

echo alexaRank("");


No comments:

Post a Comment