src/HttpRequest.php
public function getRequestIp()
    {
        $headers = [
            'HTTP_CLIENT_IP',
            'HTTP_X_FORWARDED_FOR',
            'HTTP_X_FORWARDED',
            'HTTP_FORWARDED_FOR',
            'HTTP_FORWARDED',
            'REMOTE_ADDR',
        ];
        foreach ($headers as $header) {
            if ($this->server($header) !== false) {
                return $this->server($header);
            }
        }

        return 'UNKNOWN';
    }
public function getRequestIp()
    {
        $headers = [
            'HTTP_CLIENT_IP',
            'HTTP_X_FORWARDED_FOR',
            'HTTP_X_FORWARDED',
            'HTTP_FORWARDED_FOR',
            'HTTP_FORWARDED',
            'REMOTE_ADDR',
        ];
        foreach ($headers as $header) {
            if ($this->server($header) !== false) {
                return $this->server($header);
            }
        }

        return 'UNKNOWN';
    }
public function getRequestIp ( ) { $ headers = [ 'HTTP_CLIENT_IP' , 'HTTP_X_FORWARDED_FOR' , 'HTTP_X_FORWARDED' , 'HTTP_FORWARDED_FOR' , 'HTTP_FORWARDED' , 'REMOTE_ADDR' , ] ; foreach ( $ headers as $ header ) { if ( $ this -> server ( $ header ) !== false ) { return $ this -> server ( $ header ) ; } } return 'UNKNOWN' ; }
Use this method to get the CLIENT REQUEST IP.
Note that if you behing a Proxy, the variable REMOTE_ADDR will always have the same IP
@return string
Use this method to get the CLIENT REQUEST IP . Note that if you behing a Proxy the variable REMOTE_ADDR will always have the same IP