I am wondering what I should be using for my situation. Basicaly, I have a script where I need to get the hostname/domain name information in a reliable way.

PHP Code:
echo $_SERVER['SERVER_NAME'];
echo 
$_SERVER['HTTP_HOST']; 
Sometimes when I use server_name", it only shows me the IP. But I always thought this is more "reliable" than http_host.

Any thoughts?