Alexa.com alternative

Status
Not open for further replies.
9 comments
I currently use this for Alexa Rank

PHP:
    public function get_alexa_rank(){
        $api_url = "http://data.alexa.com/data?cli=10&dat=snbamz&url=".$this->url;
        $content = self::get_content($api_url);
        if (empty($content)) 
        {
            return intval(0);
        }
        else
        {
            $xml = new SimpleXMLElement($content);  
            $popularity = $xml->xpath("//POPULARITY");
            if(isset($popularity[0]['TEXT']))
            {
                $rank = (string)$popularity[0]['TEXT']; 
            }
            else
            {
                $rank = 0;
            }
            return intval($rank);
        }
    }
 
Status
Not open for further replies.
Back
Top