I think I have read every answer out there regarding problems getting PUT request body on Slim framework (running on Windows XAMPP). None of the solution seem to work for me, so maybe there is another caveat I'm missing.
My php code follows:
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->run();
$app->put('/calendar/update/:id', function($id) use ($app){
$ev = json_decode($app->request()->getBody());
echo var_dump($ev); // NULL
}
I have been testing it in REST tester in PHPStorm, both using parameters and query string - to no avail. I tried to set contentType: application/x-www-form-urlencoded
explicitly in my ajax call as well.
Seem to be getting lost here...
Had similar issue. If you are using a form to send put request. Add this hidden field to your form. Also don't forget to move $app-run(); to the last line.
<input type="hidden" name="_METHOD" value="PUT"/>