0

I tried a code from another question and it didn't work.

<?php
$ref = $_SERVER["HTTP_REFERER"];
echo "Referrer = $ref";
?>

What is wrong with code? All it displays is "Referrer = "

  • What happened with your last question? http://stackoverflow.com/questions/37104390/storing-http-referrer-as-a-variable/ under a different username ? – Pedro Lobito May 08 '16 at 21:09
  • create a link on your question ( you can remove it after) to the php file with the code above. – Pedro Lobito May 08 '16 at 21:10
  • Did you go to this page from another one ? If it's the first page you visit, it's absolutely normal that the referer is empty. – Spilarix May 08 '16 at 21:11
  • http://stackoverflow.com/questions/12369615/serverhttp-referer-missing – RST May 08 '16 at 21:22

1 Answers1

0

When you clicked from another link $_SERVER["HTTP_REFERER"] can initialize.

Hamid
  • 118
  • 1
  • 9