I am trying to change and configure another REST server in PHP. It is based on a REST Server written by Phil Sturgeon. I really liked everything, but my requests are not working properly.
The server constructor contains the code
switch ($this->request->method) { case 'post': $this->_post_args = $_POST; $this->request->format and $this->request->body = file_get_contents('php://input'); break; }
I know that php://input can only be read once, so var_dump(file_get_contents('php://input')) before setting the variables shows that my XML data is correctly read from the input stream, but obviously the variables not installed correctly.
But when executing var_dump($this->request->body) only NULL output! Is there a special way to store php://input content in a variable?
EDIT:
I use the Kitchen API to send a POST request and the headers it sends,
Status: 200 X-Powered-By: PHP/5.3.2-1ubuntu4.11 Server: Apache/2.2.14 (Ubuntu) Content-Type: application/xml Date: Fri, 10 Feb 2012 11:00:43 GMT Keep-Alive: timeout=15, max=100 Content-Length: 936 Connection: Keep-Alive
I can not understand what encoding is.
EDIT 3:
The encoding is application/x-www-form-urlencoded , which may be where the problem is! How specifically to say what it should be?
EDIT 2:
$this->request->method contains 'post'
source share