I need to make a PATCH
request to a PHP application.
How can I get the data from that PATCH
request inside that application?
If I had to do it with a POST
, it would just be a simple access to the global $_POST
variable.
I need to make a PATCH
request to a PHP application.
How can I get the data from that PATCH
request inside that application?
If I had to do it with a POST
, it would just be a simple access to the global $_POST
variable.
You can get data with
php://input
stream wrapper:Also make sure your web server supports PATCH requests, some are configured to respond only to GET and POST.
I know that this has been solved, but for anyone who was hoping for an answer like
there is a way to do that:
then you can access it like
$_GET["something"]
and$_POST["something"]
just dohope that helped someone :)
You have
$_REQUEST
superglobal containing all data we can get regardless the HTTP method used (GET
,POST
,PATCH
,PUT
)