phpurlreferrals

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?


Solution

  • 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.