From: Alexey Borzov on
Hi Robert,

On 04.03.2010 12:48, Robert P. J. Day wrote:
> given that i don't know a whole lot (read: nothing) about custom
> POST bodies, here's what i'm after. i want to put together a POST
> request with which i can upload one or more POST parameters, plus an
> arbitrary amount of content. i can't use the file upload feature
> since i may not have a filename to go with the data, i'm just going to
> be handed that content.
>
> i know i can use addPostParameter() to pass those POST parameters,
> and i can extract them at the other end by referring to $_POST. that
> part's easy. but i don't see how to extend that to *additionally*
> passing that single large chunk of content.
>
> i suspect i could just make that another POST parameter whose value
> would be a massively long stream of bytes. is there anything untoward
> about that? or is there a better (more approved) way of doing what
> i'm after? can i combine adding POST parameters with setting the
> body?

No, you either set the body yourself via setBody() or let HTTP_Request2 build it
from stuff passed to addPostParameter() and addUpload().

Also note that HTTP_Request2 doesn't currently have a means to send a chunk of
data with unknown length.
From: "Robert P. J. Day" on
On Fri, 5 Mar 2010, Alexey Borzov wrote:

> Hi Robert,
>
> On 04.03.2010 12:48, Robert P. J. Day wrote:
> > given that i don't know a whole lot (read: nothing) about
> > custom POST bodies, here's what i'm after. i want to put together
> > a POST request with which i can upload one or more POST
> > parameters, plus an arbitrary amount of content. i can't use the
> > file upload feature since i may not have a filename to go with the
> > data, i'm just going to be handed that content.
> >
> > i know i can use addPostParameter() to pass those POST
> > parameters, and i can extract them at the other end by referring
> > to $_POST. that part's easy. but i don't see how to extend that
> > to *additionally* passing that single large chunk of content.
> >
> > i suspect i could just make that another POST parameter whose
> > value would be a massively long stream of bytes. is there
> > anything untoward about that? or is there a better (more
> > approved) way of doing what i'm after? can i combine adding POST
> > parameters with setting the body?
>
> No, you either set the body yourself via setBody() or let
> HTTP_Request2 build it from stuff passed to addPostParameter() and
> addUpload().

got it -- i just misunderstood what was meant by the term "body."
my fault.

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================