Entry
Is there a way to capture the URL from the page a visitor has come from?
Jan 25th, 2001 21:14
Philip Olson, mark romero,
Yes! Using the predefined variable HTTP_REFERER, this can be done.
Read about predefined variables here :
http://www.php.net/manual/en/language.variables.predefined.php
Not all browsers provide this information but most do. A couple ways
to print out this variable is as such :
print $HTTP_REFERER;
print getenv('HTTP_REFERER');
Calling this directly will print nothing, a referrer MUST exist. Also
it's worth mentioning that referer is a misspelling but that's just how
it is, here's some information on that :
http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=referer
In a sense, a referer is referred ;-)