HTTP_REFERER Issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dselva
Forum Newbie
Posts: 1
Joined: Wed May 16, 2007 1:37 am

HTTP_REFERER Issue

Post by dselva »

Hi,

I have used $_SERVER['HTTP_REFERER']; in my web page, to check the referrer site url.

It work for some websites, Not for many. Huh

Even i used $_SERVER to list all the server variables, but not getting HTTP_REFERER variable.

So, please kindly help me to resolve this issue.


Thanks In advance,
dselva
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

That (optional) information is received from the client, if the browser doesn't want to show it's refering website then theres nothing you can do about it.
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

And clients can modify the value. There are add-ons for FF. So never trust this.
User avatar
The Phoenix
Forum Contributor
Posts: 294
Joined: Fri Oct 06, 2006 8:12 pm

Re: HTTP_REFERER Issue

Post by The Phoenix »

dselva wrote:I have used $_SERVER['HTTP_REFERER']; in my web page, to check the referrer site url.
Its optional, so some browsers and users choose not to pass it along.

It can also be blocked by corporate filters. If someone browses from work, and they use a proxy, you won't get a referrer.

It can also be blocked by plug-ins, add-ons, and by user action on a one-off basis, so it could work for a user one day, and not another.

When typing an url into a new window, or loading your page as a homepage on startup, or clicking on a saved link to your site, the referrer will be blank.

Its completely unreliable. Its nice to have, but do not rely on it.
dselva wrote:Even i used $_SERVER to list all the server variables, but not getting HTTP_REFERER variable.
Some webservers do not provide the http_referer variable at all.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

If you are using this to track referrals to your web site, you would be better off having a database table with the names/ids of people who are referring traffic to you.

Then, when someone clicks their referral link to your site (that must contain their name/id), you can update the record in your referral table to increment the corresponding referral count for that name/id.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply