Page 1 of 1

get domain name

Posted: Thu Nov 17, 2005 10:17 am
by hanzo
Hello,

Is there a way to know from what domain name people are surfing?

By example I have domain1.com and domain2.com, they point to the same site. Can I see with a php function if the user is from domain1 or domain2 ?


Thanks
Hans

Posted: Thu Nov 17, 2005 10:34 am
by Burrito
you can use $_SERVER['SERVER_NAME'];

check out the list of enviroment vars here: http://us3.php.net/reserved.variables

Posted: Thu Nov 17, 2005 10:34 am
by ody

Code: Select all

<?

echo $_SERVER['HTTP_HOST'];

?>