How to get referrer parameters?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jan

    How to get referrer parameters?

    If a referrer contains parameters, and I'd like to save these in a
    cookie, is this possible?

    I may have a banner at www.yahoo.com, this may include a link like


    If I use the regular PHP parameter for referrer it gets only
    www.yahoo.com, is it possible to make it store the parameter in the
    link banner=mail&col or=red or
    https://www.mysite.com/index.html?ba...ail&color=red? Thus not just the
    referrer, but what the referring site requested/linked to at mysite.com?

  • Janwillem Borleffs

    #2
    Re: How to get referrer parameters?

    Jan wrote:[color=blue]
    > If a referrer contains parameters, and I'd like to save these in a
    > cookie, is this possible?
    >[/color]

    When provided, its value is stored in the following variable:
    $_SERVER['HTTP_REFERER']

    And yes, it's misspelled...


    JW


    Comment

    • Jonathan Wiltshire

      #3
      Re: How to get referrer parameters?


      "Janwillem Borleffs" <jw@jwscripts.c om> wrote in message
      news:440ac9eb$0 $71441$dbd41001 @news.euronet.n l...[color=blue]
      > Jan wrote:[color=green]
      >> If a referrer contains parameters, and I'd like to save these in a
      >> cookie, is this possible?
      >>[/color]
      >
      > When provided, its value is stored in the following variable:
      > $_SERVER['HTTP_REFERER']
      >
      > And yes, it's misspelled...[/color]

      That wasn't the question, rather collecting the get string from the
      referrer. However I believe PHP trims the referrer to show only the URI, not
      the whole request string. If you have access to log files you could use
      these to parse out the referrers, but that's only really helpful *after* the
      event, because the server will probably lock them until they are next
      rotated.

      Jon


      Comment

      • Janwillem Borleffs

        #4
        Re: How to get referrer parameters?

        Jonathan Wiltshire wrote:[color=blue]
        > That wasn't the question, rather collecting the get string from the
        > referrer. However I believe PHP trims the referrer to show only the
        > URI, not the whole request string. If you have access to log files
        > you could use these to parse out the referrers, but that's only
        > really helpful *after* the event, because the server will probably
        > lock them until they are next rotated.
        >[/color]

        When the link to the PHP script is called from a page which itself is called
        with a query string and the link is clicked, the $_SERVER['HTTP_REFERER']
        variable will contain the full URL, including the query string of the
        originating page.

        However, this is not the query string sent to the PHP script. So, when the
        page containing the link is called with http://domain/?a=b and the link is
        clicked sending the query string "foo=bar", the called PHP script will
        receive http://domain/?a=b as the referrer (stored in the
        $_SERVER['HTTP_REFERER'] variable) and the query string "foo=bar" will be
        stored in $_GET, $_REQUEST or $_SERVER['QUERY_STRING'] as usual.


        JW


        Comment

        Working...