Connecting Tech Pros Worldwide Help | Site Map

How to get referrer parameters?

  #1  
Old March 5th, 2006, 11:15 AM
Jan
Guest
 
Posts: n/a
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
www.mysite.com/index.html?banner=mail&color=red

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&color=red or
www.mysite.com/index.html?banner=mail&color=red? Thus not just the
referrer, but what the referring site requested/linked to at mysite.com?

  #2  
Old March 5th, 2006, 11:35 AM
Janwillem Borleffs
Guest
 
Posts: n/a

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


  #3  
Old March 5th, 2006, 12:55 PM
Jonathan Wiltshire
Guest
 
Posts: n/a

re: How to get referrer parameters?



"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:440ac9eb$0$71441$dbd41001@news.euronet.nl...[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


  #4  
Old March 5th, 2006, 01:35 PM
Janwillem Borleffs
Guest
 
Posts: n/a

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


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
get raw headers? =?Utf-8?B?TWFyaw==?= answers 4 June 27th, 2008 09:06 PM
how to setup a download page Jeff Jarrell answers 3 November 19th, 2005 10:07 PM
refresh without request parameters? Bo Rasmussen answers 10 July 23rd, 2005 03:39 PM
Pop quiz, hot shots! Chung Leong answers 1 July 17th, 2005 05:43 AM