public function getHttpHost()
    {
        if (isset($_SERVER['HTTP_HOST'])
            && isset($_SERVER['SERVER_NAME'])
            && $_SERVER['HTTP_HOST'] === $_SERVER['SERVER_NAME']
        ) {
            return $_SERVER['HTTP_HOST'];
        }

        if (isset($_SERVER['HTTP_HOST'])) {
            return $_SERVER['HTTP_HOST'];
        }

        // This is the least reliable, due to the ability to spoof it
        if (isset($_SERVER['SERVER_NAME'])) {
            return $_SERVER['SERVER_NAME'];
        }

        return null;
    }
public function getHttpHost()
    {
        if (isset($_SERVER['HTTP_HOST'])
            && isset($_SERVER['SERVER_NAME'])
            && $_SERVER['HTTP_HOST'] === $_SERVER['SERVER_NAME']
        ) {
            return $_SERVER['HTTP_HOST'];
        }

        if (isset($_SERVER['HTTP_HOST'])) {
            return $_SERVER['HTTP_HOST'];
        }

        // This is the least reliable, due to the ability to spoof it
        if (isset($_SERVER['SERVER_NAME'])) {
            return $_SERVER['SERVER_NAME'];
        }

        return null;
    }
public function getHttpHost ( ) { if ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) && isset ( $ _SERVER [ 'SERVER_NAME' ] ) && $ _SERVER [ 'HTTP_HOST' ] === $ _SERVER [ 'SERVER_NAME' ] ) { return $ _SERVER [ 'HTTP_HOST' ] ; } if ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) ) { return $ _SERVER [ 'HTTP_HOST' ] ; } // This is the least reliable, due to the ability to spoof it if ( isset ( $ _SERVER [ 'SERVER_NAME' ] ) ) { return $ _SERVER [ 'SERVER_NAME' ] ; } return null ; }
Return the http host, if possible.

@return null|string
Return the http host if possible .