PHP: How to get referrer URL?
$_SERVER['HTTP_REFERER']
will give you the referrer page's URL if there exists any. If users use a bookmark or directly visit your site by manually typing in the URL, http_referer will be empty. Also if the users are posting to your page programatically (CURL) then they're not obliged to set the http_referer as well. You're missing all _
, is that a typo?
If $_SERVER['HTTP_REFERER']
variable doesn't seems to work, then you can either use Google Analytics or AddThis Analytics.
Underscore. Not space.
$_SERVER['HTTP_REFERER']