This is the situation:
I have a simple app made in Angular JS that comunicate with the server through an API made in codeigniter.
There is a
Although this is already answered I quite often have this quick little utility included in many of my applications that need to accept both application/x-www-form-urlencoded and application/json POSTs.
if (strcasecmp($_SERVER['REQUEST_METHOD'], 'post') === 0 && stripos($_SERVER['CONTENT_TYPE'], 'application/json') !== FALSE) {
// POST is actually in json format, do an internal translation
$_POST += json_decode(file_get_contents('php://input'), true);
}
After that point you can now just use the $_POST superglobal as you normally would, all the JSON data will be decoded for you.