0

I'm using codeigniter with REST_Controller library. And so far I've been using $this->input->post() to get the values sent by POST request.

However, some values are sent in the body as a json encoded string, which I am not able so see with the $this->input->post()

Now I was able to access the json string using file_get_contents('php://input') but this way doesn't seem to be safe out of the box I find it highly unlikely that codeigniter wouldn't have this figured out.

So my question is: is file_get_contents('php://input') really the only way to access these variables in codeigniter or is there a more framework defined way to do it?

Tadej Magajna
  • 2,765
  • 1
  • 25
  • 41

1 Answers1

0

The request is being sent by PUT, which is why CI doesn't pick it up with post().

file_get_contents('php://input') is the only way to access HTTP PUT in code igniter; however, this extensions of CI_Input will handle HTTP PUT.

Community
  • 1
  • 1