Returns instance's external IP address.

@return mixed
970839
public static function getExternalIP()
    {
        $ip = \Cache::rememberForever('external-ip-address', function () {
            $response = Curl::get('http://ipinfo.io/ip');
            $ip = trim($response, "\t\r\n");
            try {
                $validator = Validator::make(['ip' => $ip], ['ip' => 'ip']);
                $validator->validate();
            } catch (ValidationException $e) {
                $ip = null;
            }

            return $ip;
        });

        return $ip;
    }
580021
private function getIp()
    {
        $ip = $this->env->get("HTTP_CLIENT_IP");
        $ip = $ip ?: $this->env->get("HTTP_X_FORWARDED_FOR");
        $ip = $ip ?: $this->env->get("REMOTE_ADDR");
        $ip = long2ip(ip2long($ip));
        return $ip;
    }
1251550
public function ip()
    {
        if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
            $ip_add = $_SERVER['HTTP_CLIENT_IP'];
        } elseif (!empty($_SERVER['HTTP_X_FORWADED_FOR'])) {
            $ip_add = $_SERVER['HTTP_X_FORWADED_FOR'];
        } else {
            $ip_add = $_SERVER['REMOTE_ADDR'];
        }

        return $ip_add;
    }
751696
public static function getIp() {

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

		if(isset($_SERVER['HTTP-X-FORWARDED-FOR'])) {
			return $_SERVER['HTTP-X-FORWARDED-FOR'];
		}
		
		if(isset($_SERVER['HTTP_VIA'])) {
			return $_SERVER['HTTP_VIA'];
		}
		
		if(isset($_SERVER['REMOTE_ADDR'])) {
			return $_SERVER['REMOTE_ADDR'];
		}
	}
526545
public static function get_client_ip() {
        $ipaddress = '';
        if (getenv('HTTP_CLIENT_IP')) $ipaddress = getenv('HTTP_CLIENT_IP');
        else if (getenv('HTTP_X_FORWARDED_FOR')) $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
        else if (getenv('HTTP_X_FORWARDED')) $ipaddress = getenv('HTTP_X_FORWARDED');
        else if (getenv('HTTP_FORWARDED_FOR')) $ipaddress = getenv('HTTP_FORWARDED_FOR');
        else if (getenv('HTTP_FORWARDED')) $ipaddress = getenv('HTTP_FORWARDED');
        else if (getenv('REMOTE_ADDR')) $ipaddress = getenv('REMOTE_ADDR');
        else $ipaddress = 'UNKNOWN';
        return $ipaddress;
    }
607680
function ip() {
		$headers=$this->hive['HEADERS'];
		return isset($headers['Client-IP'])?
			$headers['Client-IP']:
			(isset($headers['X-Forwarded-For'])?
				explode(',',$headers['X-Forwarded-For'])[0]:
				(isset($_SERVER['REMOTE_ADDR'])?
					$_SERVER['REMOTE_ADDR']:''));
	}
526111
public function getIp()
    {
        $ip = '';

        if ($_SERVER['REMOTE_ADDR']) {
            $ip = $_SERVER['REMOTE_ADDR'];
        } elseif (getenv('HTTP_CLIENT_IP')) {
            $ip = getenv('HTTP_CLIENT_IP');
        } elseif (getenv('HTTP_X_FORWARDED_FOR')) {
            $ip = getenv('HTTP_X_FORWARDED_FOR');
        } elseif (getenv('HTTP_X_FORWARDED')) {
            $ip = getenv('HTTP_X_FORWARDED');
        } elseif (getenv('HTTP_FORWARDED_FOR')) {
            $ip = getenv('HTTP_FORWARDED_FOR');
        } elseif (getenv('HTTP_FORWARDED')) {
            $ip = getenv('HTTP_FORWARDED');
        }

        return $ip;
    }
135567
public function getIpAddress()
    {
        foreach ($this->headers as $k)
        {
            if (isset($this->server[$k]))
            {
                // header can be comma separated
                $ips = explode(',', $this->server[$k]);
                $ip = trim(end($ips));
                $ip = filter_var($ip, FILTER_VALIDATE_IP);
                if (false !== $ip)
                {
                    return $ip;
                }
            }
        }

        // no valid ip found
        return false;
    }
624714
public function getIpAddress(): string
    {
        if ($this->ip !== null) {
            return $this->ip;
        }
        $keys = [
            'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
            'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'
        ];
        foreach ($keys as $key) {
            if (array_key_exists($key, $_SERVER) === true) {
                foreach (explode(',', $_SERVER[$key]) as $ip) {
                    if ($this->validateIp($ip = trim($ip))) {
                        return $ip;
                    }
                }
            }
        }
        return '127.0.0.1';
    }
992377
public function getRemoteAddress()
    {
        if (($sValue = $this->getViewConfigParam('ip')) === null) {
            $sValue = \OxidEsales\Eshop\Core\Registry::getUtilsServer()->getRemoteAddress();
            $this->setViewConfigParam('ip', $sValue);
        }

        return $sValue;
    }
320505
public static function getIp() {
        if (!empty ($_SERVER ["HTTP_CLIENT_IP"])) {
            $cip = $_SERVER ["HTTP_CLIENT_IP"];
        } else if (!empty ($_SERVER ["HTTP_X_FORWARDED_FOR"])) {
            $cip = $_SERVER ["HTTP_X_FORWARDED_FOR"];
            $cip = trim(implode(',', $cip)[0]);
        } else if (!empty ($_SERVER ["REMOTE_ADDR"])) {
            $cip = $_SERVER ["REMOTE_ADDR"];
        } else {
            $cip = "";
        }

        return $cip;
    }
1230910
public function getClientIp()
    {
        foreach (['HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
                     'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',] as $key) {
            if ($ips = $this->request->getServer($key, false)) {
                foreach (explode(',', $ips) as $ip) {
                    $ip = trim($ip); // just to be safe
                    if (filter_var(
                            $ip,
                            FILTER_VALIDATE_IP,
                            FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE
                        ) !== false) {
                        return $ip;
                    }
                }
            }
        }
    }
768543
public function getRemoteIP(): string
    {
        $server = $this->server;

        if (!empty($server['HTTP_CLIENT_IP'])) {
            return $server['HTTP_CLIENT_IP'];
        }

        if (!empty($server['HTTP_X_FORWARDED_FOR'])) {
            return $server['HTTP_X_FORWARDED_FOR'];
        }

        return $server['REMOTE_ADDR'];
    }
1180314
public function getIp(): string
	{
		if($this->ip === null)
		{
			$ip = $this->server->get('REMOTE_ADDR');

			if(!empty($this->trustedProxies))
			{
				$ips = $this->server->get('HTTP_X_FORWARDED_FOR');

				if(!empty($ips))
				{
					$ips = array_map('trim', explode(',', $ips));

					foreach($ips as $key => $value)
					{
						foreach($this->trustedProxies as $trustedProxy)
						{
							if(IP::inRange($value, $trustedProxy))
							{
								unset($ips[$key]);

								break;
							}
						}
					}

					$ip = end($ips);
				}
			}

			$this->ip = (filter_var($ip, FILTER_VALIDATE_IP) !== false) ? $ip : '127.0.0.1';
		}

		return $this->ip;
	}
411082
protected function getIp()
    {
        if (getenv('HTTP_CLIENT_IP')) {
            $ipAddress = getenv('HTTP_CLIENT_IP');
        } elseif (getenv('HTTP_X_FORWARDED_FOR')) {
            $ipAddress = getenv('HTTP_X_FORWARDED_FOR');
        } elseif (getenv('HTTP_X_FORWARDED')) {
            $ipAddress = getenv('HTTP_X_FORWARDED');
        } elseif (getenv('HTTP_FORWARDED_FOR')) {
            $ipAddress = getenv('HTTP_FORWARDED_FOR');
        } elseif (getenv('HTTP_FORWARDED')) {
            $ipAddress = getenv('HTTP_FORWARDED');
        } elseif (getenv('REMOTE_ADDR')) {
            $ipAddress = getenv('REMOTE_ADDR');
        } else {
            $ipAddress = '127.0.0.1';
        }

        return $ipAddress;
    }
357600
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';
    }
248388
public static function getIp()
	{
		if (self::$ip === null)
		{
			$ip = self::detectAndCleanIP();

			if (!empty($ip) && ($ip != '0.0.0.0') && \function_exists('inet_pton') && \function_exists('inet_ntop'))
			{
				$myIP = @inet_pton($ip);

				if ($myIP !== false)
				{
					$ip = inet_ntop($myIP);
				}
			}

			self::setIp($ip);
		}

		return self::$ip;
	}