Get URL's host

@return string
@throws \Koldy\Url\Exception
197759
public function getHost(): string
    {
        if (!isset($this->segments['host'])) {
            throw new UrlException('Unable to get host for ' . $this->url);
        }

        return $this->segments['host'];
    }
225182
public function getHost()
    {
        $host = $this->headers->get('HTTP_HOST');
        if ($host) {
            if (strpos($host, ':') !== false) {
                $hostParts = explode(':', $host);

                return $hostParts[0];
            }

            return $host;
        }

        return $this->env->get('SERVER_NAME');
    }
972568
public function GetHost () {
		if ($this->host === NULL) $this->host = $this->globalServer['HTTP_HOST'];
		return $this->host;
	}
1198839
public static function getHost()
    {
        $host = '';
        if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && $host = $_SERVER['HTTP_X_FORWARDED_HOST']) {
            $elements = explode(',', $host);
            $host     = trim(end($elements));
        } else {
            if (isset($_SERVER['HTTP_HOST']) && !$host = $_SERVER['HTTP_HOST']) {
                if (isset($_SERVER['SERVER_NAME']) && !$host = $_SERVER['SERVER_NAME']) {
                    $host = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
                }
            }
        }
        // Remove port number from host
        $host = preg_replace('/:\d+$/', '', $host);

        return trim($host);
    }
168497
public function getHost()
    {
        if ($this->isSandboxEnabled()) {
            $url = $this->getPayPalSandboxHost();
        } else {
            $url = $this->getPayPalHost();
        }

        return $url;
    }
353898
protected function get()
    {
        $url = '';
        if ($this->scheme) {
            $url = $this->scheme . ':';
        }
        if ($this->host) {
            $url .= '//' . $this->authority();
        }
        if ($this->path) {
            $url .= '/' . ltrim($this->path, '/');
        }
        if ($this->query) {
            $url .= '?' . $this->query;
        }
        if ($this->fragment) {
            $url .= '#' . $this->fragment;
        }

        return $url;
    }
75416
public function getBaseUrl()
    {
        $url = '';
        if (isset($this->scheme)) {
            if ('' !== $this->scheme) {
                $url .= $this->scheme . ':';
            }
            $url .= '//';
        }

        if (isset($this->user)) {
            $url .= $this->user;

            if (isset($this->pass)) {
                $url .= ':' . $this->pass;
            }

            $url .= '@';
        }

        $url .= $this->host;

        if (isset($this->port)) {
            $url .= ':' . $this->port;
        }

        if (isset($this->path)) {
            if ($url != '' && $this->path[0] !== '/') {
                $url .= '/';
            }

            $url .= $this->path;
        }

        return $url;
    }
340050
public function getHost()
    {
        if ($this->initialized) {
            $hostname = $this->getHostName();

            if (($this->secure && $this->port != self::HTTPS_PORT) ||
                 (!$this->secure && $this->port != self::HTTP_PORT)) {
                $hostname .= ':'.$this->port;
            }

            return $hostname;
        }

        throw new BadMethodCallException('Connection not initialized');
    }
1283908
public function getSiteUrl(): string
    {
        $url = $this->getStringValue(PlatformConfigurationInterface::KEY_SITE_URL);

        if (empty($url)) {
            $scheme = \filter_input(INPUT_SERVER, 'REQUEST_SCHEME');
            $server = \filter_input(INPUT_SERVER, 'SERVER_NAME');
            $url = $scheme.'://'.$server;
        }

        return $url;
    }
406925
function getHost()
    {
        if ($this->host)
            return $this->host;
        
        // attempt to get host from target uri
        $host  = $this->getTarget();
        $host  = parse_url($host, PHP_URL_HOST);
        if (!$host && $this->headers()->has('Host')) {
            /** @var iHeader $host */
            $host = $this->headers()->get('Host');
            $host = $host->renderValueLine();
        }

        return $host;
    }
457708
protected static function getRequestUrl()
    {
        $hostname = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null);

        if(isset($hostname))
        {
            $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';

            if(!isset($_SERVER['REQUEST_URI']))
            {
                if(isset($_SERVER['QUERY_STRING']))
                {
                    return $protocol . '://' . $hostname . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
                }
                else
                {
                    return $protocol . '://' . $hostname . $_SERVER['PHP_SELF'];
                }
            }
            else
            {
                return $protocol . '://' . $hostname . $_SERVER['REQUEST_URI'];
            }
        }
        else
        {
            return null;
        }
    }
31019
public function getHostName()
    {
        $remoteAddress = $this->server()->remoteAddress();

        $host = $this->server()->serverName();
        $fwdHost = $this->server()->get($this->getTrustedHeaders()['client_host']);
        if ($fwdHost && $fwdHost != '' && in_array($remoteAddress, $this->getTrustedProxies())) {
            $host = $fwdHost;
        }

        return strtolower($host);
    }
1341198
public function getAbsoluteUrl(): string
    {
        if (!$this->absoluteUrl) {
            // Guessing we're a http endpoint.
            $this->absoluteUrl = 'http://'.
                ($this->getHeader('Host') ?? 'localhost').
                $this->getUrl();
        }

        return $this->absoluteUrl;
    }
862051
public function getCurrentUrl()
    {
        $oUtilsServer = \OxidEsales\Eshop\Core\Registry::getUtilsServer();

        $aServerParams["HTTPS"] = $oUtilsServer->getServerVar("HTTPS");
        $aServerParams["HTTP_X_FORWARDED_PROTO"] = $oUtilsServer->getServerVar("HTTP_X_FORWARDED_PROTO");
        $aServerParams["HTTP_HOST"] = $oUtilsServer->getServerVar("HTTP_HOST");
        $aServerParams["REQUEST_URI"] = $oUtilsServer->getServerVar("REQUEST_URI");

        $sProtocol = "http://";

        if (isset($aServerParams['HTTPS']) && (($aServerParams['HTTPS'] == 'on' || $aServerParams['HTTPS'] == 1))
            || (isset($aServerParams['HTTP_X_FORWARDED_PROTO']) && $aServerParams['HTTP_X_FORWARDED_PROTO'] == 'https')
        ) {
            $sProtocol = 'https://';
        }

        return $sProtocol . $aServerParams['HTTP_HOST'] . $aServerParams['REQUEST_URI'];
    }
1224343
public function getCurrentUrl() {
        $script = self::getScriptName();
        if ( $script === false ) return false; 
        $pieces = $this->apphome;
        if ( $this->apphome ) {
            $pieces = parse_url($this->apphome);
        }
        // We only take scheme, host, and port from wwwroot / apphome
        if ( ! isset($pieces['scheme']) ) return false;
        $retval = $pieces['scheme'].'://'.$pieces['host'];
        if ( isset($pieces['port']) ) $retval .= ':'.$pieces['port'];
        return $retval . $script;
    }
619991
public function GetDomainUrl () {
		if ($this->domainUrl === NULL) 
			$this->domainUrl = $this->GetScheme() . '//' . $this->GetHost();
		return $this->domainUrl;
	}
214904
public function getHost() : string
    {
        $host = null;

        if ($this->isUsingTrustedProxy() && $this->headers->has(self::$trustedHeaderNames[RequestHeaders::CLIENT_HOST])) {
            $hosts = explode(',', $this->headers->get(self::$trustedHeaderNames[RequestHeaders::CLIENT_HOST]));
            $host = trim(end($hosts));
        }

        if ($host === null) {
            $host = $this->headers->get('HOST');
        }

        if ($host === null) {
            $host = $this->server->get('SERVER_NAME');
        }

        if ($host === null) {
            // Return an empty string by default so we can do string operations on it later
            $host = $this->server->get('SERVER_ADDR', '');
        }

        // Remove the port number
        $host = strtolower(preg_replace("/:\d+$/", '', trim($host)));

        // Check for forbidden characters
        // Credit: Symfony HTTPFoundation
        if (!empty($host) && !empty(preg_replace("/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/", '', $host))) {
            throw new InvalidArgumentException("Invalid host \"$host\"");
        }

        return $host;
    }