Hi there friends, Im trying with php to get the referal domain to my site. I mean the domain that the client clicked the link to come to my site. I used the $_SERVER['HTTP_REFERER']; command and it works fine in any of my pages, in my domain but it works ( i think ) randomly with any of other domains. What i did was to click from other sites that my link exist in (ive put an echo $_SERVER['HTTP_REFERER']; before in the script) and nothing appeared, but clicking at the same time another page in my site the domain appeared. So i cant understand was it the wrong with this damn command? Is there any other command to take the referal domain from others sites? Just want to make a database to track the referals!
You are doing right, $_SERVER['HTTP_REFERER'] is a php source of referring page. And it is always works fine - it just gets the contents of Referer header passed to your web server by browser. What kind of links to your site do you have on external sites? They are plain html, javascript, flash, ..?
Just plain html you know the standar < a href ...... I dont know it doesnt work for me, i did try only two lines of php script <?php $referer = $_SERVER['HTTP_REFERER']; echo $referer; ?> I go to an external site i puss my link => directs me to my homepage and nothing appears! ??? Is there any posibility the server that i nest my site to delay so i dont get to see the result? What should i do?
You've probably got problems because of your browser cache. You see a problem while your testing it, because you are going to a page that you have already visited recently. Set IE to "Check for new versions everytime you visit" in Temporary Internet Files settings. Then you should see it working just fine. Cryo.
This is from PHP documentation... If you want to track your referrals I dont think this is the most accurate way of doing this...
Well you mean that not all of the hits to my site are gona be counted? I think also that giving every partner of my site a variable to pass with my link is the best but how im gona contact and inform so many, its very dificult. I was looking for a way to baypass this - if you got any suggestion plz inform me and thank you for you help.
It sounds like you're trying to create an affiliate script from scratch. If so, I would strongly recommend purchasing one of the many pre-made scripts available. I really like Post Affiliate Pro but there's also IDev Affiliate (and many others). As others have mentioned, not only is 'HTTP_REFERER' unreliable, but easy to spoof. Firefox has an option not to send it at all. Using this variable as the lynch pin for any application is setting yourself up for dissapointment. I think you're on the right track in your last post in that you're talking about passing a variable (in the url?). That's the most common and effective method. Then you set a cookie and you can track visitor activity that way. Hope that helps.
If you're making an affiliate script, don't go off the referrer. Just pass a unique ID as a GET parameter to the target URL. Something like: www.yoursite.com/thepage?r=TwistMyArm or something.