0

I am trying to get the referer with php using:

var_dump($_SERVER["HTTP_REFERER"]);

But it returns NULL.

I put this code in sample.php, This file linked in index.php and when I click on link, it shows sample.php file but referer returns NULL. What am I missing?

What I'm trying to do is, getting previous file name, I mean when I go to sample.php from a page, I want to get previous page file name.

I've worked with referer before, however I have not seen this result before. Any ideas?

kajetons
  • 4,481
  • 4
  • 26
  • 37
Jack The Baker
  • 1,781
  • 1
  • 20
  • 51
  • `The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.` http://php.net/manual/en/reserved.variables.server.php – adprocas Apr 02 '18 at 16:03
  • And this - https://stackoverflow.com/questions/6880659/in-what-cases-will-http-referer-be-empty – adprocas Apr 02 '18 at 16:06

0 Answers0