943,948 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 7010
  • PHP RSS
Feb 21st, 2008
1

Get Referrer

Expand Post »
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
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
vaibhavs is offline Offline
6 posts
since Feb 2008
Feb 21st, 2008
0

Re: Get Referrer

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?
Reputation Points: 19
Solved Threads: 11
Junior Poster
richie513 is offline Offline
158 posts
since Feb 2008
Feb 21st, 2008
0

Re: Get Referrer

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
Reputation Points: 232
Solved Threads: 137
Practically a Master Poster
buddylee17 is offline Offline
665 posts
since Nov 2007
Feb 21st, 2008
0

Re: Get Referrer

Quote ...
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.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Feb 22nd, 2008
0

Re: Get Referrer

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
Reputation Points: 11
Solved Threads: 0
Newbie Poster
vaibhavs is offline Offline
6 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: connecting database
Next Thread in PHP Forum Timeline: Which one is the Best PHP editor





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC