Retrieve Domain Name instead of IP

Posted by Vincent on Stack Overflow See other posts from Stack Overflow or by Vincent
Published on 2010-05-21T16:38:05Z Indexed on 2010/05/21 16:40 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

All,

I am using the following command to retrieve the domain name of my server.

$_SERVER['HTTP_HOST']

This seems to return the IP address instead of domain name like www.example.com. I looked at PHPInfo and it also lists an IP address for HTTP_HOST instead of Domain name. What do I need to change to make the domain name appear instead of IP?

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about apache2