1

Hi,

I have a PHP Script. I need the referrer website address for this script.

I used the following 2 commands:
getenv('HTTP_REFERER');
$_SERVER["HTTP_REFERER"]

I believe both are the same.

But in majority of the cases I am unable to get any values using the above 2 variables.

I would not believe that 90% of the worlds browsers have javascript disabled.
Correct me if I am wrong.

Is there any 100% sure method of getting referrer ??

Thx
Vai

4
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by vaibhavs
0

Hi Vai,

Usually PHP will make the referrer automatically available in the variable, Have you had a look to see if these variables are available using phpinfo?

0

These variables will be empty if someone
A.)gets to your site via a link with a target="_blank".
B.)types the url directly into the browser
C.)Came from a bookmark or favorite
D.)Right clicked to open your link in a new tab/window

0

A.)gets to your site via a link with a target="_blank".
D.)Right clicked to open your link in a new tab/window

I just tested it and it works.

0

The code is working fine.
I get the value of referer, but for only a small % of hits.

Hence I was wondering if there are situations which are not captured by this PHP command.
OR if I need anyother command.

This is being done for evaluating hits from search engines.

Thx

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.