phasync
FormBody / input

Method

FormBody::input

php://input: an url-encoded body's bytes, still readable after parsing; a multipart one's are used up by the parser, as in PHP.

Description#

public FormBody::input(): StreamInterface

Return values#

StreamInterface

Examples#

Example 1The raw bytes after parsing
use phasync\Psr\StringStream;
use Swerve\Psr\FormBody;

$form = FormBody::for('POST', 'application/x-www-form-urlencoded', new StringStream('a=1&b=2'));

var_export($form->fields());
echo "\n";
echo $form->input()->getContents(), "\n";     // php://input: still readable after parsing
Output
array (
  'a' => '1',
  'b' => '2',
)
a=1&b=2