How do you get the 'referer' header in PHP?

I want the URL of the page from which the request was made. How can I do this in PHP?

+5
source share
2 answers

Reference (r) er can be found in a global variable $_SERVER. Note that sending the (r) er link is completely optional, and the user agent may simply decide not to send the (r) ing link.

$_SERVER['HTTP_REFERER']
+17
source
$_SERVER['HTTP_REFERER']

Documentation is available here .

+7
source

All Articles