With PHP, you can not use $_POST variable if the content you are POSTing, is JSON. Instead, you must use a different method for getting the JSON data from the POST.

<?php
//assures the content being posted is content-type of application/json
if($_SERVER["CONTENT_TYPE"] == 'application/json')
{
$json_string = file_get_contents('php://input');
$json = json_decode($json_string);
//$json will be an object with the data that was in the POST
}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *