I am trying to get the POST data that is being sent to a controller method within my CI project. However, I am not able to get this data which ever way I try to get it.
I have checked NGROK Inspect and Im able to see the data that I want as you can see in the screenshot below:
The problem is when I try to access this date from the controller method itself, I get nothing, not sure if Im accessing it wrong, but the following are what I have tried:
$Data = json_decode(file_get_contents('php://input'), true); //Method 1
$response = $this->input->post("Body"); // Method 2
$data = $this->input->post(); //Method 3
I get nothing whenever I try to use the methods above. This is how the Controller method looks like, basically, it creates a json file and saves the response there:
public function resolve_payment(){
$data = $this->input->post();
$fp = fopen("testdir.json", 'w');
fwrite($fp, json_encode($data, JSON_UNESCAPED_SLASHES));
fclose($fp);
}