473,416 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

How to get referrer parameters?

Jan
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?

Mar 5 '06 #1
3 27725
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
Mar 5 '06 #2

"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:44***********************@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
Mar 5 '06 #3
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
Mar 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ryann | last post by:
Hello. I had a strange entry in my referrer logs. The http-referrer reported that the user came from another site. But the file it claimed to come from a pdf file. I followed the link back and...
1
by: kuok benny | last post by:
Hi, I am trying to use the document.referrer to get the referrer of my home page. Occationally, I get the value of 'blockedReferrer'. Actually how this happen, how the client blocked the...
1
by: brett | last post by:
When I use this code: <select name="status" onChange = "location.href=this.options.value"> <option value="mypage.htm">Select View</option> </select> I don't have a referrer. When I click an...
2
by: Goober | last post by:
I have to determine the document.referrer of the individual coming to my site. I want to send everyone not coming from one of those sites to an alternate location (The names below are just used as...
1
by: Mike Dee | last post by:
Hi All - I'm having a strange problem I'm wondering if anyone can shed some light on. When I use ASP or ASP.NET code to get the referrer information from the server side, it comes back as null. ...
2
by: Fernando Rodríguez | last post by:
Hi, Is there a way to turn the document.referrer string into a Location like object, so I can extrac the domain and other parts of it? Thansk
5
by: Nospam | last post by:
does anyone know if there is anything wrong with this code? <SCRIPT LANGUAGE="JavaScript">document.referrer.indexOf("http://www.example.com") != -1){ ...
1
by: Nospam | last post by:
I have a site http://www.example.com, and I want to link to an article on another site http://www.example2.com, how would I use the site http://www.example.com , as a referrer to the article on the...
10
by: Trev | last post by:
Hi all, I'm trying to create some javascript that will provide the user of the referring page, but if I do something like the following: <HTML> <HEAD> </HEAD> <BODY> <script>
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.