Swoole\Http\Request->getContent()

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());
});