07-11-2002, 11:07 PM
i'm trying to write some code that will look at the site you just came from and store the URL into a .txt file. its not working. here is my code:
$fp = fopen('refferer.txt','a');
$reffer = getenv(HTTP_REFFERER);
07-11-2002, 11:49 PM
Although I've never used PHP, I think it should be HTTP_REFERER
And keep in mind that REFERER will be blank if the user enters the URL in the address bar.
07-12-2002, 12:54 PM
Robby is correct, it's HTTP_REFERER.
You might know this already, but just as a side note, this is set by the user agent, but not all user agents will set this. Therefore it's not really trustworthy.
Also, if your using php version 4.1.0 or higher you can use the $_SERVER["HTTP_REFERER"] instead. getenv(HTTP_REFFERER) will not work with register globals off feature (I don't think).