$_SERVER['HTTP_HOST']. It should contain host name and port, as it was requested by http client.
For example, I have a PHP script located at
https://somesite.com/script.php, but there's a DNS entry
sitewrapper.org that points to
https://somesite.com/script.php. In this case,
somesite.com. How can I access
I need to execute some code based on the URL the user is accessing the site through, not the actual server name.