CodeIgniter Forums
Problem w/ retrieving $_POST content with REST_Controller and REST api - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem w/ retrieving $_POST content with REST_Controller and REST api (/showthread.php?tid=44273)



Problem w/ retrieving $_POST content with REST_Controller and REST api - El Forum - 08-09-2011

[eluser]Unknown[/eluser]
I am trying to use Phil Sturgeon's REST_Controller to setup a REST api to receive request from Backbone.js, and then update them in a MySQL DB through php.
Backbone.js by default send a RESTful json request.

The problem I have is I'm not able to use $this->post('name') to retrieve the POST content. When it enters it into the DB, it created a new entry, but the content is 0.

Here are some relevant info from the browser console

Request MethodTongueOST
Status Code:200 OK
Request Headersview source
Accept:application/json, text/javascript, */*; q=0.01
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:15
Content-Type:application/json
Host:www.williamsham.com
X-Requested-With:XMLHttpRequest

Request Payload
{"title":"my Content!!"}