Read Request Payload in Codeigniter

I was using Codeigniter with Backbone. When I try to call the save() method in the Backbone it sent a POST Request to the server. But it sends data to the server using a Request Payload and not the standard Form Data approach that jQuery, and standard HTML forms submit with.. After a bit study I think there are two easy way to handle this.

On the front end you can enable Backbone.emulateJSON() or on the server side, $requestBody = json_decode(file_get_contents('php://input'),true);.

I heard something like $this->request->body but it never works.


  1. oceanhere posted this