Get the domain name of the current url.

@return string|bool Domain name, or false it's not set.
970304
public function getDomain()
    {
        if($this->getScheme() && $this->getHost()) {
            return $this->getScheme() . '://' . $this->getHost();
        }

        return false;
    }
563438
public function getHostName()
    {
        if (strpos($this->getWorkingHost(), ':') === false) {
            return $this->getWorkingHost();
        }

        $info = explode(':', $this->getWorkingHost());
        return $info[0];
    }
552689
public function getDomainNames()
    {
        return $this->getCache('domainNames', function () {
            $list = array_merge($this->aliases, $this->pointers, [$this->getDomainName()]);
            sort($list);
            return $list;
        });
    }
598022
public function getHostname()
    {
        if ($this->hostname === null) {
            $hostname = @gethostbyaddr($this->hostAddress);
            if ($hostname === false) {
                $hostname = $this->hostAddress;
            }
            $this->hostname = $hostname;
        }

        return $this->hostname;
    }
1034669
public static function GetUrl () {
		return static::LasyClassVarAccessCallback('url', function () {return sprintf('%s://%s%s%s', strtolower(static::GetCurrnetProtocol()), static::GetDomainName(), static::GetPath(), !empty($query_parameter = static::GetParameters()->getRecursiveArrayCopy()) ? sprintf('?%s', http_build_query($query_parameter)) : '');});
	}
62511
public static function getSecondDomain() {
        $serverName = filter_input(INPUT_SERVER, 'SERVER_NAME');
        $serverArr = explode('.', $serverName);
        $domain = array_shift($serverArr);

        return $domain;
    }
1038888
public function toString()
   {

      if ( empty( $this->_subdomainName ) )
      {

         if ( \is_null( $this->_sld ) )
         {
            return '';
         }

         return $this->_sld->toString();

      }

      if ( \is_null( $this->_sld ) )
      {
         return $this->_subdomainName;
      }

      return $this->_subdomainName . '.' . $this->_sld->toString();

   }
875116
public function getDomain()
    {
        $model = explode("\\", $this->getModelNamespace());
        return strlen($model[0]) || 1 === count($model) ? $model[0] : $model[1];
    }
240998
public static function currentPageURL()
    {
        $pageURL = 'http';
        if ($_SERVER["HTTPS"] == "on") {
            $pageURL .= "s";
        }
        $pageURL .= "://";
        if ($_SERVER["SERVER_PORT"] != "80") {
            $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
        } else {
            $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
        }
        $pageURL = str_replace('?live', '?', $pageURL);
        $pageURL = str_replace('&live', '', $pageURL);

        return $pageURL;
    }
406736
public function getHostname()
    {
        if (is_null($this->hostname)) {
            $this->hostname = gethostbyaddr($this->ip);
        }

        return $this->hostname;
    }
830719
public static function getCurrentURL()
    {
        $url = 'http://';
        if (self::isHttps()) {
            $url = 'https://';
        }

        if (isset($_SERVER['PHP_AUTH_USER'])) {
            $url .= $_SERVER['PHP_AUTH_USER'];
            if (isset($_SERVER['PHP_AUTH_PW'])) {
                $url .= ':'.$_SERVER['PHP_AUTH_PW'];
            }
            $url .= '@';
        }
        if (isset($_SERVER['HTTP_HOST'])) {
            $url .= $_SERVER['HTTP_HOST'];
        }
        if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80) {
            $url .= ':'.$_SERVER['SERVER_PORT'];
        }
        if (!isset($_SERVER['REQUEST_URI'])) {
            $url .= substr($_SERVER['PHP_SELF'], 1);
            if (isset($_SERVER['QUERY_STRING'])) {
                $url .= '?'.$_SERVER['QUERY_STRING'];
            }

            return $url;
        }

        $url .= $_SERVER['REQUEST_URI'];

        return $url;
    }
732386
private function currentURL() {
        $pageURL = 'http';
        if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
            $pageURL .= "s";
        }
        $pageURL .= "://";
        if ($_SERVER["SERVER_PORT"] != "80") {
            $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
        } else {
            $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
        }
        return $pageURL;
    }
631610
@Override
    public String getName () {
        boolean d = this.domain != null && this.domain.length() > 0;
        return d ? this.domain + "\\" + this.username : this.username;
    }
584039
protected function serverHostname()
    {
        $result = 'localhost.localdomain';
        if (!empty($this->Hostname)) {
            $result = $this->Hostname;
        } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
            $result = $_SERVER['SERVER_NAME'];
        } elseif (function_exists('gethostname') && gethostname() !== false) {
            $result = gethostname();
        } elseif (php_uname('n') !== false) {
            $result = php_uname('n');
        }
        return $result;
    }
977637
public function getDomain() {
		$fullBaseUrl = Router::fullBaseUrl();
		if (!empty($fullBaseUrl)) {
			$domain = parse_url($fullBaseUrl, PHP_URL_HOST);
		} else {
			$domain = 'localhost';
		}

		return $domain;
	}
1266173
public static function getServerURL()
    {
        if ( self::$serverURL === null  )
        {
            $oeini = eZINI::instance( 'ezoe.ini' );
            if ( $oeini->hasVariable( 'SystemSettings', 'RelativeURL' ) &&
                 $oeini->variable( 'SystemSettings', 'RelativeURL' ) === 'enabled' )
            {
                self::$serverURL = eZSys::wwwDir();
                if ( self::$serverURL === '/'  )
                    self::$serverURL = '';
            }
            else
            {
                $domain = eZSys::hostname();
                $protocol = eZSys::serverProtocol();

                self::$serverURL = $protocol . '://' . $domain . eZSys::wwwDir();
            }
        }
        return self::$serverURL;
    }
962050
public function strip_www() {
		if (! $this->is_valid() || \is_null($this->subdomain)) {
			return false;
		}

		if (
			('www' === $this->subdomain) ||
			(0 === \strpos($this->subdomain, 'www.'))
		) {
			$this->subdomain = \preg_replace('/^www\.?/u', '', $this->subdomain);
			if (! \strlen($this->subdomain)) {
				$this->subdomain = null;
			}

			$this->host = \preg_replace('/^www\./u', '', $this->host);
			return true;
		}

		return false;
	}