Can someone tell me that:
Can we get two step back referrer using php ? for example someone come though google.com to mysite.com and then he/she clicked on any other page of like mysite.com/page.php and on that page referrer should be google.com not mysite.com
possible ? Pleas help
You can save it to cookie or session and use it on the next page.
if (!isset($_SESSION)) {
session_start();
}
if (!isset($_SESSION['referrer'])) {
$_SESSION['referrer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'n/a';
}
// another page
$referer = isset($_SESSION['referrer']) ? $_SESSION['referrer'] : null;
use $_SERVER['HTTP_REFERER']
will get referrer if exists
I was looking to do the same thing a couple years ago. It is impossible to achieve it. If it is otherwise, i would be interested to know.
The variable
$_SERVER['HTTP_REFERER']
CAN contain the referer, but it can only go one level deep, so you can see where the visitor came from, one step back, but not two steps.