People come to my website from variety of other websites and I would like to know these referral 开发者_如何学JAVAurls? How can I do it in PHP?
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.
$ref = getenv("HTTP_REFERER");
or
$ref = $_SERVER['HTTP_REFERER'];
Use the system variable:
$_SERVER['HTTP_REFERER']
Check this answer for more details.
Determining Referer in PHP
精彩评论