public static function getAlexaRank($domain)
    {
        $domain = preg_replace('~^https?://~', '', $domain);
        $alexa = 'http://data.alexa.com/data?cli=10&dat=s&url=%s';
        $request_url = sprintf($alexa, urlencode($domain));
        $xml = simplexml_load_file($request_url);

        if (!isset($xml->SD[1])) {
            return false;
        }

        $nodeAttributes = $xml->SD[1]->POPULARITY->attributes();
        $text = (int) $nodeAttributes['TEXT'];

        return $text;
    }
public static function getAlexaRank($domain)
    {
        $domain = preg_replace('~^https?://~', '', $domain);
        $alexa = 'http://data.alexa.com/data?cli=10&dat=s&url=%s';
        $request_url = sprintf($alexa, urlencode($domain));
        $xml = simplexml_load_file($request_url);

        if (!isset($xml->SD[1])) {
            return false;
        }

        $nodeAttributes = $xml->SD[1]->POPULARITY->attributes();
        $text = (int) $nodeAttributes['TEXT'];

        return $text;
    }
public static function getAlexaRank ( $ domain ) { $ domain = preg_replace ( '~^https?://~' , '' , $ domain ) ; $ alexa = 'http://data.alexa.com/data?cli=10&dat=s&url=%s' ; $ request_url = sprintf ( $ alexa , urlencode ( $ domain ) ) ; $ xml = simplexml_load_file ( $ request_url ) ; if ( ! isset ( $ xml -> SD [ 1 ] ) ) { return false ; } $ nodeAttributes = $ xml -> SD [ 1 ] -> POPULARITY -> attributes ( ) ; $ text = ( int ) $ nodeAttributes [ 'TEXT' ] ; return $ text ; }
Get Alexa ranking for a domain name.

@param string $domain Domain name to get ranking for

@return mixed false if ranking is found, otherwise integer
Get Alexa ranking for a domain name .