Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: Get Referrer
07-01-2005, 04:23 PM #1
- Join Date
- Apr 2005
- San Diego, CA
- Thanked 0 Times in 0 Posts
I want to know when someone visits my site from clicking the link in my AIM profile. I figure I'll just change the link from http://www.sumeetjain.com to http://www.sumeetjain.com?referrer=aim or something like that, but I don't know how that will tell me who actually is the referrer. I use ShortShat by Shaun Inman if that helps.
Does anyone know if there is a preset PHP get selector that will return the referrer?
07-01-2005, 04:45 PM #2
- Join Date
- Jun 2005
- Near Chicago, IL, USA
- Thanked 32 Times in 31 Posts
Most browsers send a header called "referer" that tells you what page they came in from. Not all do, and it can be mucked with. But it works for most people for most things they need it for.
No need to add special code to your links unless this gives you problems:
<?php echo($_SERVER['HTTP_REFERER']); ?>
If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit http://www.kaelisspace.com/
07-01-2005, 05:41 PM #3
Only 100% effective way to to write a script that opens up your server logs and displays the results there