...

View Full Version : What site is the user trying to access



RyanB88
11-28-2006, 06:08 AM
I am devloping a page which will have several domains parked on it so the user can access the page from one of several domains. My issue is I want to find out with PHP what url they entered to get to my script, I assume just getting the referer won't work so is their a way to get the url they typed in? Because the page is going to vary slightly depending on the domain so i need to get the domain they entered to pull the correct info from my db.

GJay
11-28-2006, 07:04 AM
take a look at the contents of the $_SERVER superglobal, I think (though I get the names confused sometimes) that $_SERVER['HTTP_HOST'] will contain what you're after

RyanB88
11-28-2006, 07:09 AM
take a look at the contents of the $_SERVER superglobal, I think (though I get the names confused sometimes) that $_SERVER['HTTP_HOST'] will contain what you're after

from http://us3.php.net/reserved.variables

'HTTP_HOST'
Contents of the Host: header from the current request, if there is one.

its kinda vauge but dosen't sound like it gives me what I want,

from the same site

'QUERY_STRING'
The query string, if any, via which the page was accessed.


this sounds like what I would use but I am not sure, I have to way to qucikly test this as of now, so if you can verify this i'd appriciate it.

GJay
11-28-2006, 10:50 AM
print_r($_SERVER);
echo $_SERVER['HTTP_HOST'];

will tell you...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum