views:

28

answers:

1

Could you explain me? Because in stats I can find Refelar links and I am curious. How are they made? Is it placed somewhere in HTTP request?

+4  A: 

Yes, it's available by the referer header. Note that this is an optional field and its value can be spoofed by the client manually or by a client side application like some firewalls and internet security applications do (Norton Internet Security is known in this). You should preferably not let any business logic rely on this, but rather use it for pure statistics only.

How to grab it depends on the server side language you're using. In PHP you can do:

$referrer = $_SERVER['HTTP_REFERER'];

In Java/Servlet you can do:

String referrer = request.getHeader("referer");

Note the legendaric misspelling in the header field name.

BalusC