user220755 user220755 - 3 months ago 8x
PHP Question

Referral URL in php

So I am trying to get the page where a visitor came from. I inserted this code into a php file and I am trying to see the page's URL but it is not working, any suggestions?


$ref = getenv("HTTP_REFERER");
echo $ref;


(added this after some answers)
I have also tried


and that doesn't work either

it worked after i updated the website many times, not sure why was there a problem in the first place, thanks anyway :)


Have you tried accessing through the $_SERVER superglobal?