For the router, I wanted to get the host name from the URI upon a server request. I know that I need to read it from the $_SERVER
variable. But it seems that in the $_SERVER
array there are multiple entries (at least two) for the host name.
Could you please tell me which value should I choose to read - the most reliable one?
For example, when I have an URI like this:
http://local.mvc/mycontroller/myaction
the $_SERVER
array will have:
[HTTP_HOST] => local.mvc
[SERVER_NAME] => local.mvc
I need to obtain the value local.mvc
.
Thank you for your time.