Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get raw request in PHP?

I have a script called api.php on my server. I call it from other server using POST request. Is there any way to get in my api.php raw contents of POST request?

like image 889
Tom Smykowski Avatar asked Jul 20 '10 12:07

Tom Smykowski


People also ask

How to get raw POST data in php?

The preferred method for accessing the raw POST data is php://input . $HTTP_RAW_POST_DATA is not available with enctype="multipart/form-data" . This feature was DEPRECATED in PHP 5.6. 0, and REMOVED as of PHP 7.0.

What is a raw request?

This method performs a raw HTTP request, allowing you as a flow builder to control all aspects of the HTTP request. This allows a flow to call an XML service or call an HTML service, or a number of other advanced usages.


1 Answers

use the following code

$data = file_get_contents('php://input');
like image 118
Ahmed Aman Avatar answered Sep 30 '22 13:09

Ahmed Aman