How to get referrer parameters?

This is a discussion on How to get referrer parameters? within the PHP Language forums, part of the PHP Programming Forums category; If a referrer contains parameters, and I'd like to save these in a cookie, is this possible? I may ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-05-2006
Jan
 
Posts: n/a
Default 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
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?

Reply With Quote
  #2 (permalink)  
Old 03-05-2006
Janwillem Borleffs
 
Posts: n/a
Default Re: How to get referrer parameters?

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


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

And yes, it's misspelled...


JW


Reply With Quote
  #3 (permalink)  
Old 03-05-2006
Jonathan Wiltshire
 
Posts: n/a
Default Re: How to get referrer parameters?


"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:440ac9eb$0$71441$dbd41001@news.euronet.nl...
> Jan wrote:
>> If a referrer contains parameters, and I'd like to save these in a
>> cookie, is this possible?
>>

>
> When provided, its value is stored in the following variable:
> $_SERVER['HTTP_REFERER']
>
> And yes, it's misspelled...


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


Reply With Quote
  #4 (permalink)  
Old 03-05-2006
Janwillem Borleffs
 
Posts: n/a
Default Re: How to get referrer parameters?

Jonathan Wiltshire wrote:
> 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.
>


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


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:12 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0