PDA

View Full Version : Recording referring URL


Len Whistler
08-23-2005, 05:37 AM
What is the php code to record the referring URL?

So that if there is a link to my site, and a visitor clicks it, I will know the website they came from. Thanks.

Yaggles
08-23-2005, 05:44 AM
This is the PHP code for displaying on the page where the user came from.
You can insert it into a database or whatever, so taht you can know, but if a user clicks a link to the page, you can show them this so they know where they came from (as if they didn't already).

<?
$HTTP_SERVER_VARS['HTTP_REFERER'];
?>

Len Whistler
08-23-2005, 06:04 AM
Thanks Yaggles

I already got that code up and running on my site and it does EXACTLY what I want.

Fou-Lu
08-23-2005, 09:12 AM
1. $HTTP_*_VARS is now depreciated. Use $_* superglobals instead.
2. HTTP_REFERER is a client request. It is therefore not trustworthy, so do not use it as a method of security.

Len Whistler
08-23-2005, 04:50 PM
Ok thanks Fou-Lu

I have set up Google Adwords and I want to find the URL of the websites where visitors click on my ads.