Receiving JSON POST data in PHP is a common scenario I come across when building custom WordPress API’s. If you’re working with JSON API’s powered by PHP you may find that
$_POST is not working with JSON, and you may be seeing a broken response of
Processing $_POST data with
To receive a request with a content-type of
$data = json_decode( file_get_contents( 'php://input' ), true );
This is really for my own reference/editor integration, but hopefully it’s helpful to you as well!
About the Author