Jump to content

$_SERVER['HTTP_REFERER']; Problem


dselva

Recommended Posts

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. ???

 

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,

Selvakumar.D

 

Link to comment
Share on other sites

php.net says:

 

'HTTP_REFERER'

The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

 

Maybe that is the problem?

 

 

Link to comment
Share on other sites

Hi All,

 

Thanks for your reply...

 

The following code i am using to track the referrer.

 

<?

/* Javascript Referer Script*/

echo "Javascript Refferer<br>";

 

$JSURL="<script>document.write(document.referrer)</script>";

$JSHOSTADDR=parse_url($JSURL);

$JSRefererURL=$JSHOSTADDR["host"];

echo $JSRefererURL;

 

 

echo "<br><br>------------------<br><br>";

 

 

/* PHP Referer Script*/

echo "PHP Refferer<br>";

 

$URL=$_SERVER['HTTP_REFERER'];

$HOSTADDR=parse_url($URL);

$RefererURL=$HOSTADDR["host"];

echo $RefererURL;

?>

 

When i was using javascript(document.referrer), getting referrer URL.Not in PHP($_SERVER['HTTP_REFERER']).

 

When i parse the Referrer URL, I am not getting HOST address in JavaScript. But getting in PHP.

 

 

Can anyone plz give me solution for this issue.

 

Thanks

Selvakumar.D

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.