Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    May 2003
    Location
    England
    Posts
    21

    Default Can't get HTTP_REFERER

    Whatever code I use I can't get php to give me a HTTP_REFERER. I've tried
    $HTTP_SERVER_VARS['HTTP_REFERER']

    $_SERVER['HTTP_REFERER']

    and other variations but I just get the error:
    Notice: Undefined index: HTTP_REFERER

    I've checked phpinfo() and the HTTP_REFERER doesn't seem to be mentioned there. Do I need to change my php.ini file or something to be able to get the HTTP_REFERER details?

  2. #2
    Senior Member jalal's Avatar
    Join Date
    May 2003
    Location
    Germany
    Posts
    1,377

    Default

    There is not always a referer!

    If I type into the location bar of my browser 'http://www.mydomain.com' then there is no referer at all.
    If I create a page somewhere with a link that I can click on then the referer will be set.

    $_SERVER['HTTP_REFERER'] is not always set and your code needs to check for that and deal with it.

    HTH

  3. #3
    Junior Member
    Join Date
    May 2003
    Location
    England
    Posts
    21

    Default

    Strange - I tried linking from another page yesterday and even using different browsers as well but still had the same error message. Today I try it and it works fine. Thanks for making me try again jalal.

Posting Permissions

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