I need to know the referring server for a page on my site.
Is there any safe method to check where the user “came” to the page FROM?
I tried uploading this to my server, but this wont output anything at all when I write the adress to the file in the browsers adress bar:
<?php echo $_SERVER['HTTP_REFERER']; ?>
I need to check this in order to display a link on the page or not…
Thanks
Try using
$_SERVER['HTTP_REFERER']. Notice that it is ‘HTTP_REFERER’, NOT, as one would expect, ‘HTTP_REFERRER’Also, please note the documentation on this variable:
In addition, ceejayoz is correct in noting that if you go directly to a page and don’t follow a link there, most browsers will not set a referrer.