 <p>You would access the superglobal <a href="http://php.net/manual/reserved.variables.server.php" rel="nofollow"><code>$_SERVER</code></a> and its key <code>HTTP_HOST</code>:</p> <pre><code>echo 'Hello, and welcome to ' , $_SERVER['HTTP_HOST']; </code></pre>