priyabrata
priyabrata

Reputation: 169

Can I get the url referral of the original referral website?

is it possible to get the original referrer in php ie.

google.com -> yourwebsite.com -> mywebsite.com

is it possible to get google.com as url referer on mywebsite.com if a visitor click on google.com then yourwebsite.com then mywebsite.com

and can i know that the visitor originally came from google.com at the point of mywebsite.com

i am trying

session_start();
if(!isset($_SESSION['org_referer']))
{
    $_SESSION['org_referer'] = $_SERVER['HTTP_REFERER'];
}

Upvotes: 0

Views: 148

Answers (2)

user3227262
user3227262

Reputation: 583

This is one really good question I have come across in recent times. Something, to be honest, which even I wondered this possibility sometime. Technically, 'No'. This simply cannot be done at the moment. Primarily because of the way HTTP is designed to work. As @priyabrata pointed out earlier, HTTP is a stateless protocol. To begin with, lets consider your example You visit google.com and then from there you are directed to yourwebsite.com. Here, this request from google to the yourwebsite.com page and then page load response from yourwebsite.com completes one HTTP cycle. At this, point HTTP has is sitting stale. It has no strings attached with previous cycle. HTTP is simple waiting for another request to be made. Now, when you go to mywebsite.com from yourwebsite.com, HTTP calls and exits one new HTTP cycle.

Upvotes: -1

user557846
user557846

Reputation:

no, its not possible, http is by definition a stateless protocol

Upvotes: 3

Related Questions