Is it possible to change $ _ ['http_referer'] in php?

Possible duplicate:
PHP - referral redirection script

I want to make a script that modifies the http_referer browser, for example

I have a link

http://www.mysite.com/page.php?changeRefererTo=mysite2.com&redirectTo=www.newwebsite.com

ChangeRefererTo holds a value that will change the http_referer browser code. after changing http_referer it will be redirected to $ redirectTo.

is this possible with php?

+4
source share
2 answers

You cannot change the referrer server view from the server. You can change $_['http_referer'] in PHP, but this only affects what PHP sees and not what the browser sees. If you were able to change the browser referrer, this will be a security issue, as sites can force the browser to use any referrer they need.

However, your PHP script can retrieve the page using any referer you need and then display the result to the user. See PHP - referral redirection script for a processed example of this.

+3
source

You can not.

The referent is set by the browser (i.e. the client side). PHP runs on the server side and cannot modify information on the client side.

Another option is to change it using javascript, but browsers will not let you change it . If you absolutely must click www.newwebsite.com using the abstract from mysite2.com , you can use cURL or similar libraries that allow you to set your own HTTP headers. It is assumed that you do not have control over mysite2.com . If you have control over it, you can redirect to mysite2.com from mysite.com , and then redirect to www.newwebsite.com from mysite2.com .

+1
source

All Articles