How can I tell the url a visitor is coming from?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sirkoolaid
Forum Newbie
Posts: 1
Joined: Fri Aug 29, 2008 4:56 pm

How can I tell the url a visitor is coming from?

Post by sirkoolaid »

How can I tell the url a visitor is coming from with PHP?
User avatar
Ziq
Forum Contributor
Posts: 194
Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh

Re: How can I tell the url a visitor is coming from?

Post by Ziq »

Code: Select all

<?
echo $_SERVER['HTTP_REFERER'];
?>
'HTTP_REFERER'
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.
$_SERVER PHP manual
Post Reply