Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 3.1.8 JSON Post fails
#1

Hello Community,
I am attempting a JSON POST request to a controller.
The header is:
Code:
[{"key":"Content-Type","value":"application/json"}]
I am trying a minimal payload:
Code:
{"user":1}
According to multiple write ups I have tried the following:

Code:
public function authorize(){
   echo 'Line 37';//Works perfectly
   print_r($this->input->raw_input_stream);//NULL
   print_r(json_decode($this->input->raw_input_stream));//NULL
   print_r(json_decode(file_get_contents('php://input')));//NULL
   print_r(json_decode(trim(file_get_contents('php://input')), true));//NULL
   print_r(json_decode(file_get_contents("php://in‌​put"), true));//file_get_contents(): Invalid php:// URL specified
}


I am using Postman to make the request.
Any clue?

Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
Codeigniter 3.1.8 JSON Post fails - by pigfox - 05-12-2018, 08:58 PM
RE: Codeigniter 3.1.8 JSON Post fails - by pigfox - 05-13-2018, 10:58 AM
RE: Codeigniter 3.1.8 JSON Post fails - by pigfox - 05-13-2018, 02:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB