note 125651 added to reserved.variables.post
| From: | (at) | Date: | Sun, 03 Jan 2021 16:13:40 +0000 |
| Subject: | note 125651 added to reserved.variables.post | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216057@lists.php.net to get a copy of this message | ||
If you want to receive application/json post data in your script you can not use $_POST. $_POST does
only handle form data.
Read from php://input instead. You can use fopen or file_get_contents.
Example:
<?php
// Get the JSON contents
$json = file_get_contents('php://input');
// decode the json data
$data = json_decode($json);
?>
----
Server IP: 45.112.84.4
Probable Submitter: 195.138.250.34 (proxied: 2003:d3:f44:cc00:a50b:6747:27c1:e4c5)
----
Manual Page -- http://php.net/manual/en/reserved.variables.post.php
Edit -- https://master.php.net/note/edit/125651
Del: integrated -- https://master.php.net/note/delete/125651/integrated
Del: useless -- https://master.php.net/note/delete/125651/useless
Del: bad code -- https://master.php.net/note/delete/125651/bad+code
Del: spam -- https://master.php.net/note/delete/125651/spam
Del: non-english -- https://master.php.net/note/delete/125651/non-english
Del: in docs -- https://master.php.net/note/delete/125651/in+docs
Del: other reasons-- https://master.php.net/note/delete/125651
Reject -- https://master.php.net/note/reject/125651
Search -- https://master.php.net/manage/user-notes.php