Page 1 of 1

How do I see $HTTP_REFERER

Posted: Sun Nov 19, 2006 4:25 am
by fatman
I have 2 URL's resolving to the same page. I want to know which one?

I need the value of $site

If I use this code:

Code: Select all

if (preg_match ("/www.mydomain.com/i", "$HTTP_REFERER")) { 
    $site = "hprp"; 
}
It does not recognise the URL when I land on the page, but if I refresh, it does.

Any ideas on how I see the URL the first time I land?

Posted: Sun Nov 19, 2006 4:45 am
by timvw
For starters: Not all browsers send a http_referer header (this becomes pretty obvious with IE7) so i would not recommend to rely on that.

How would you define 'resolve' to the same page. In essence a HTTP request contains a header with GET (or POST) $url $httpversion. Via $_SERVER['HTTP_HOST'] and $_SERVER['REQUEST_URI'] you can rebuild the $url...