[FX.php List] Retrieving domain name

Steve Hannah shannah at sfu.ca
Mon Apr 10 12:18:27 MDT 2006


There should be a number of ways to get this information using the  
$_SERVER or $_ENV arrays.  Some of these are platform dependent and  
will be different depending on whether you're running PHP as CGI or  
as an apache module.

The best way to find out what is in these is just to to do:

print_r($_SERVER);

off the top of my head i think you should be able to use $_SERVER 
['HTTP_HOST'] or $_SERVER['REQUEST_URI'] and parse out the host part.

Best regards

Steve
On 10-Apr-06, at 11:11 AM, Bob Patin wrote:

> I have a client whose site uses 3 different domain names; we need  
> to track which domain name the visitor has used to get to my PHP page.
>
> Is there a way to parse out the domain name that someone used to  
> get to a PHP page? I could do it with HTML redirect pages, but I'd  
> rather do this more simply if possible.
>
> Any ideas, FX gurus? :)
>
> Thanks,
>
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
>
>   CONTACT US VIA SKYPE:
>      USERNAME: longtermsolutions
>
>   CONTACT US VIA INSTANT MESSAGING:
>      AIM or iChat: longterm1954
>      Yahoo: longterm_solutions
>      MSN: bob at patin.com
>      ICQ: 159333060
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>



More information about the FX.php_List mailing list