Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Get Referrer

  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Location
    San Diego, CA
    Posts
    107
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Get Referrer

    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?

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    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/

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Only 100% effective way to to write a script that opens up your server logs and displays the results there


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •