473,394 Members | 1,770 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,394 software developers and data experts.

Reading and Writing Headers

Gosh. I posted this earlier on Google Groups, but it didn't appear.
Perhaps there was a problem at Google. Forgive me for posting it
again. This time, I'll be more brief.

Instead of using cookies, I want to play with HTTP headers in general
because I heard you can use these to circumvent cookie
security/cleaner type apps (which I consider silly, btw). I want to
write custom headers like:

TRACK_fullname: Google Mike

I want to load a PHP page, write a custom header like that, then write
a Location header to redirect to another page, as in:

header('TRACK_fullname: Google Mike');
header('Location: test2.php');
exit;

On test2.php, I want to read this back. I cycle through the array
returned by getallheaders(), but I don't see "TRACK_fullname" in
there.

What's the catch?
Jul 17 '05 #1
3 10400
Carved in mystic runes upon the very living rock, the last words of
Google Mike of comp.lang.php make plain:
I want to load a PHP page, write a custom header like that, then write
a Location header to redirect to another page, as in:

header('TRACK_fullname: Google Mike');
header('Location: test2.php');
exit;

On test2.php, I want to read this back. I cycle through the array
returned by getallheaders(), but I don't see "TRACK_fullname" in
there.


The header() function sends response headers to the browser. The browser
sees the Location: header and generates a new request for that resource.
It has no idea what your custom header means, and has no reason to pass
it on in the request.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Jul 17 '05 #2
go********@hotpop.com (Google Mike) wrote in message news:<25**************************@posting.google. com>...
I want to load a PHP page, write a custom header like that, then write
a Location header to redirect to another page, as in:

header('TRACK_fullname: Google Mike');
header('Location: test2.php');
exit;

On test2.php, I want to read this back. I cycle through the array
returned by getallheaders(), but I don't see "TRACK_fullname" in
there.

What's the catch?


Unless your user has some special browser that recognises
'TRACK_fullname', it's just going to be ignored. The browser isn't
a header messenger.
Jul 17 '05 #3
sk
The only headers of this kind that you can send out like this and pick
up in the browser are, yes, cookies.

Of course, if what you want to do is pass something along to track in
your redirect and not worry about cookies, you can either use sessions
(for a redirect within the same site) or just set your own GET parameter
in the redirect URL, as in:

header('Location: test2.php?TRACK_fullname=Google%20Mike');

Google Mike wrote:
Gosh. I posted this earlier on Google Groups, but it didn't appear.
Perhaps there was a problem at Google. Forgive me for posting it
again. This time, I'll be more brief.

Instead of using cookies, I want to play with HTTP headers in general
because I heard you can use these to circumvent cookie
security/cleaner type apps (which I consider silly, btw). I want to
write custom headers like:

TRACK_fullname: Google Mike

I want to load a PHP page, write a custom header like that, then write
a Location header to redirect to another page, as in:

header('TRACK_fullname: Google Mike');
header('Location: test2.php');
exit;

On test2.php, I want to read this back. I cycle through the array
returned by getallheaders(), but I don't see "TRACK_fullname" in
there.

What's the catch?


Jul 17 '05 #4

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

Similar topics

1
by: Google Mike | last post by:
Tell me if this can be done, and if I have a misconception here. I am writing an app that will be served up in an app farm, and therefore I need to move the session information to the client, not...
1
by: fabrice | last post by:
Hello, I've got trouble reading a text file (event viewer dump) by using the getline() function... After 200 - 300 lines that are read correctly, it suddenly stops reading the rest of the...
5
by: ssp | last post by:
Dear all, I'm dealing with a very tricky problem and can't seem to find the answer with google. the problem is: i want to store huge data (binaries) inside a mysql databases blob - to later...
6
by: _jpg_ | last post by:
Hi, I need to read (& store) all the custom response headers in an HttpResponse. I am writing an HttpModule and hence do not know what headers could have been added (but need to cache them for...
24
by: felixnielsen | last post by:
The question is pretty simple, i have a file called "primes.txt" and funny enough it contains alot of primes (one per line) Besides that i have an empty vector: vector<__int64> P(0); How do i...
10
by: vfunc | last post by:
OK, after reading some C++ books and writing some programs that cover the core, where do I go from there, to say be able to read some open source code ? How do you unravel other peoples code when...
16
by: Jm.GlezdeRueda | last post by:
Hi all, Im trying to read a 24bit bmp with fread, and i have some problems.. I want to read the whole structure in one time, but i dont know why, it only reads the first member well.. I have...
1
by: CodeSeeker | last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4...
41
by: biplab | last post by:
Hi all, I want to read the pixel values of a .bmp image(which will be input to the code) into a matrix...plz help me out as i can not understand how to achieve this... thanks in advance ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.