i am having issue for posting data of mime type content-type application/json
from Chrome Advance rest Client to slim framework web service.
I tried these codes to send in application/json
$app->post('/register', function() use ($app) {
$app->add(new \Slim\Middleware\ContentTypes());
$params = $app->request->getBody();
$name = $params->name;
$email = $params->email;
$password = $params->password;
...});
tried this also
$params = json_decode($app->request()->getBody());
var_dumb($params); //get NULL value here
Getting errors of
Trying to get property of non-object to this `$name = $params->name;`
Please help me how to catch application/json format of data? Thank you