Forum Moderators: DixonJones
I've created a snazzy park page with some ads on them but want to know can I determine the domain someone types in and show that on the page? I could do it manually, but this intrigues me. Also, could I scan that name for a keyword (they all have them) and use that in the ad code?
I've looked around but can't see anything helpful.
Thanks.
echo $_SERVER['HTTP_HOST'];
I think that's right
ref: $_SERVER [php.net]
I tried a few other ones from that page and this is the closest:
<!--#echo var="HTTP_REFERER" -->
but it returns:
http://www.example.co.uk
when i just want example.co.uk. Is there a way of parsing it so it strips out the unwanted bits?
>> want to know can I determine the domain someone types in
I am thinking that means the domain they are at
referer is where they came from, if you echo referer and they came from google then it will say google
take a look at parse_url [php.net] for chopping up urls
When someone types in www.example.co.uk they actually go to www.mydomain.com/park/example.shtml and the typed domain stays in the addressbar. Not an elegant solution, but it's just for testing for now.