dselva Posted July 4, 2007 Share Posted July 4, 2007 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 Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted July 4, 2007 Share Posted July 4, 2007 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? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 4, 2007 Share Posted July 4, 2007 Yep, thats right. It's completely unreliable. Some firewalls also prevent/have an option of preventing the referrer being sent. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 4, 2007 Share Posted July 4, 2007 Generally, you shouldn't rely on data which users can manipulate themselves (i.e. data which come from them). Quote Link to comment Share on other sites More sharing options...
dselva Posted July 4, 2007 Author Share Posted July 4, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.