Vonder
Vonder

Reputation: 4059

How to find out what was the referral url?

People come to my website from variety of other websites and I would like to know these referral urls? How can I do it in PHP?

Upvotes: 0

Views: 537

Answers (3)

Roadmaster
Roadmaster

Reputation: 5357

Use the system variable:

$_SERVER['HTTP_REFERER']

Check this answer for more details.

Determining Referer in PHP

Upvotes: 0

code_burgar
code_burgar

Reputation: 12323

$ref = getenv("HTTP_REFERER");

or

$ref = $_SERVER['HTTP_REFERER'];

Upvotes: 0

Cam
Cam

Reputation: 15245

You can get the referrer using $_SERVER['HTTP_REFERER']. Note that it's very easy for the client to spoof this, so don't rely on it for anything important.

You can find out about other $_SERVER variables here.

Upvotes: 4

Related Questions