Swoole\Http\Request->getContent()

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\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(Swoole/Server/Request $request, Swoole/Server/Response $response)
{
    var_dump($request->getContent());
});
Last updated on September 16, 2022