Connecting Tech Pros Worldwide Help | Site Map

How to get referrer parameters?

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 5th, 2006, 10:15 AM
Jan
Guest
 
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?


  #2  
Old March 5th, 2006, 10:35 AM
Janwillem Borleffs
Guest
 
Posts: n/a
Default 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, 11:55 AM
Jonathan Wiltshire
Guest
 
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...[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, 12:35 PM
Janwillem Borleffs
Guest
 
Posts: n/a
Default 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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.