The request object mentioned in this post belongs to a package named codeigniter-restserver. You can find more information here .
The accepted answer is working, but CodeIgniter provides $this->input->raw_input_stream which gives you exactly what you need. So, to write things in the CodeIgniter way, you should use:
$jsonArray = json_decode($this->input->raw_input_stream, true);
And you will notice that the source code raw_input_stream also uses the file_get_contents('php://input') method file_get_contents('php://input') .
source share