PHP get domain name


Translate

Possible Duplicate:
HTTP_HOST vs. SERVER_NAME

Hello,

I want to get the domain name for where the script is running. How can that be done with PHP? I see that $_SERVER['HTTP_HOST'] as well as $_SERVER['SERVER_NAME'] contain this information. Will that variable always work and should I use one over the other?

Thank you.


All Answers