How to get body of a POST in PHP?

Spread the love

Sometimes, we want to get body of a POST in PHP.

In this article, we’ll look at how to get body of a POST in PHP.

How to get body of a POST in PHP?

To get body of a POST in PHP, we can use the file_get_contents function.

For instance, we write

$entity_body = file_get_contents('php://input');

to call file_get_contents with 'php://input' to get the request body.

Conclusion

To get body of a POST in PHP, we can use the file_get_contents function.

Leave a Reply

Your email address will not be published.