NYCPHP Meetup

NYPHP.org

[nycphp-talk] HTTP request body

Dan Cech dcech at phpwerx.net
Wed Sep 1 09:44:20 EDT 2004


Jerry Kapron wrote:
> G'morning,
> Is there a simple way to access  the *entire* HTTP request body as a single
> string?

Yes and no...

> Of course, I can do a foreach loop on the $_POST array and combine its
> elements into a single url-encoded string.

You can grab the contents of $GLOBALS['HTTP_RAW_POST_DATA'], but for it 
to work with multipart forms you will have to set the ini setting 
'always_populate_raw_post_data'.  Even then whether it will work or not 
is open to debate, you can find a bit more info on this here:

http://www.zend.com/lists/php-dev/200311/msg00225.html

> However, it gets more complicated when the request contains file upload data
> (especially with multiple files).

Indeed it does, best of luck,

Dan

> Cheers,
> Jerry



More information about the talk mailing list