l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Feb 05 15:18

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Question about php settings and passing form data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Question about php settings and passing form data

On Tue, Feb 04, 2003 at 10:58:17PM -0800, ME wrote:
> Troy Arnold said:
> > On Tue, Feb 04, 2003 at 06:06:49PM -0800, ME wrote:
> >> Hello,
> >>
> >> I want to use a php redirector
> >> header('Location: http://website.nofun/redirect.....)
> >> and I want to pass to the page ref-ed in the URI a number of FORM
> >> variables.
> >>
> >> However, I am meeting with little luck on this.
> >>
> >> If I encode the variables as part of the URL with "&" as a separator, I
> >> dcan get the form data and variables that store them (names) to pass
> >> through to the page.
> >
> > Clarifying, you *can* get the above to work as it should?
> Yes, the above is a method for passing form data within the URL. Of course
> this is undesirable for things like passwords, and authentication strings.
> Cookies might be better, but that assumes the form can me set to use them,
> and I dont have access to modify that.

Ahhh, so what you want is to redirect, sending your var/value pairs as
POST data?  Without access to the destination page, any session data you
create is useless, 'cause, 1) like I mentioned before, sess. data is not
passed with the request and 2) the dest. page needs to know about the

Now, you can probably do this by opening a socket directly.
Something like:

$s=fsockopen($host, 80);
fputs($s, "POST /some/file.html HTTP/1.1\r\n");
fputs($s, "host: example.com\r\n");
fputs($s, "content-type: application/x-www-form-urlencoded\r\n");
fputs($s, "content-length: " . strlen($vars)."\r\n");
fputs($s, $vars); #or urlencode($vars) , not sure.

See the "network funcs" section of the php manual
For an OO interface, see the HTTP/Request.php PEAR module.

Actually, that will probably work better, but I already typed the
above... :)

> An ideal solution would be a complement to the header directive that
> permits me to encode arbitrary header information. If I had access to
> this, then I could manually encode the form data through header data, or
> perhaps a way to force certain data to pass as html FORM data. However, it
> seems many of the low-level controls that I am familiar with using are not
> there. Certainly, many of the more complex things seem easier to code for
> the web in php, but the control with respect to granularity is missing as
> a cost of this easy to use, productive environment.

I don't think it's all missing, you just haven't learned where to look
yet. :)  It may be possible to accomplish this with the appropriate
calls to header() and perhaps some output buffering.  See "Output
Control Functions" in php manual.  Might be cajoled into working, not
sure though.

> > Also, the php function phpinfo() can be useful for debugging.
> >
> > Did I understand your problem correctly?  If not, please clarify.
> I'll play with phpinfo() to see if it offers me more than my present
> solution.

It will be a complement to, not a replacement for.  You'll see :) , tons
of cool/useful stuff about the server and php setup, etc. which is not
available through the environment or form variables.  


vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!