request_parse_body
Read and parse the request body and return the result
&reftitle.description;
arrayrequest_parse_body
arraynulloptions&null;
This function reads the request body and parses it according to the
Content-Type header. Currently, two content types are
supported:
application/x-www-form-urlencoded
multipart/form-data
This function is used primarily to parse
multipart/form-data requests with HTTP verbs other than
POST which do not automatically populate the
$_POST and $_FILES superglobals.
request_parse_body consumes the request body without
buffering it to the php://input stream.
&reftitle.parameters;
options
The options parameter accepts an associative array
to override the following global &php.ini; settings for parsing of the
request body.
max_file_uploads
max_input_vars
max_multipart_body_parts
post_max_size
upload_max_filesize
&reftitle.returnvalues;
request_parse_body returns an array pair with the
equivalent of $_POST at index 0 and
$_FILES at index 1.
&reftitle.errors;
When the request body is invalid,
according to the Content-Type header,
a RequestParseBodyException is thrown.
A ValueError is thrown when
options contains invalid keys,
or invalid values for the corresponding key.
&reftitle.examples;
request_parse_body example
]]>
request_parse_body example with customized options
'10M',
'upload_max_filesize' => '10M',
]);
// Do something with the uploaded files.
?>
]]>