src/ministruts/Request.php
public function getHostname() {
        if (!empty($_SERVER['HTTP_HOST'])) {
            $httpHost = strtolower(trim($_SERVER['HTTP_HOST']));    // nginx doesn't set $_SERVER[SERVER_NAME]
            if (strlen($httpHost))                                  // automatically to $_SERVER[HTTP_HOST]
                return $httpHost;
        }
        return $_SERVER['SERVER_NAME'];
    }
public function getHostname() {
        if (!empty($_SERVER['HTTP_HOST'])) {
            $httpHost = strtolower(trim($_SERVER['HTTP_HOST']));    // nginx doesn't set $_SERVER[SERVER_NAME]
            if (strlen($httpHost))                                  // automatically to $_SERVER[HTTP_HOST]
                return $httpHost;
        }
        return $_SERVER['SERVER_NAME'];
    }
public function getHostname ( ) { if ( ! empty ( $ _SERVER [ 'HTTP_HOST' ] ) ) { $ httpHost = strtolower ( trim ( $ _SERVER [ 'HTTP_HOST' ] ) ) ; // nginx doesn't set $_SERVER[SERVER_NAME] if ( strlen ( $ httpHost ) ) // automatically to $_SERVER[HTTP_HOST] return $ httpHost ; } return $ _SERVER [ 'SERVER_NAME' ] ; }
Return the host name the request was made to.

@return string - host name

@example
<pre>
$request->getUrl():       "http://a.domain.tld/path/application/module/foo/bar.html?key=value"
$request->getHostname():  "a.domain.tld"
</pre>
Return the host name the request was made to .