Re: how to extract the "body" of a HTTP_Request2 request?

From: Date: Fri, 05 Mar 2010 08:05:13 +0000
Subject: Re: how to extract the "body" of a HTTP_Request2 request?
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30364@lists.php.net to get a copy of this message
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.

« previous php.pear.general (#30364) next »