OpenSwoole\Http\Request->getContent()

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\Http\Request->getContent(): string

Parameters

None

Return

Original POST data request body

Description

Get the raw POST body data from the HTTP request. This method is used to obtain the original POST data which isn't in the form of application/x-www-form-urlencoded.

You can set the configuration http_parse_post to control the analysis of POST data, some applications won't require the parsing of POST data, so this give you the ability to turn it off.

Since v4.5.0 this method is available

Example

<?php

$server->on('Request', function(OpenSwoole\Server\Request $request, OpenSwoole\Server\Response $response)
{
    var_dump($request->getContent());
});
Last updated on September 20, 2022