0

Hi

I tried to use getenv('HTTP_REFERER') to get the referring url ie find out where my user came from... but on localhost i keep getting a blank...

I checked phpinfo() and the referrer was in fact blank...

Is this normal behaviour?

That Aussie Bloke

PS it is spelt HTTP_REFERER and not HTTP_REFERRER because some programmer at the time didnt spell it correctly

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by UrbanSky
0

What browser are you using? Did you test another browser?

Also are you clicking from a link on another URL?

Yes, referer is in the HTTP Protocol Specs. lol. mispelled of course.. ;)

0

Hi,

HTTP_REFERER is an optional header that clients our allowed to omitt according to the HTTP specification. But having said that most major browsers do set it.

It wont be set if you load the page directly i.e. enter the link directly but if you have clicked a link and come from another page then it will be set. (on localhost as well as it is browser set not server set).

As previously asked what browser are you testing with.

a simple check is

//torefer.html

<html>
<body>
<a href="refer.php" >Link To refer</a>
</body>
</html>

//refer.php

<?
//$_SERVER is the golbal variable for much the same as getenv
echo $_SERVER;
//should output on localhost http://localhost/torefer.html
?>

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.