Welcome Guest, Not a member yet? Register   Sign In
ErrorException Trying to access array offset on value of type null
#5

Hi,
I am getting the same Error as below, while receiving the Json API Response;
"title": "ErrorException",
    "type": "ErrorException",
    "code": 500,
    "message": "Trying to access array offset on value of type null",


And the Controller code is as below;

<?php

namespace App\Controllers;

use CodeIgniter\Controller;

class Rupiso_callback extends BaseController
{

    public function __construct(){
     
    }


public function index(){

$cryptedText = file_get_contents('php://input');
$responce = json_decode($cryptedText, true);

$type = $responce['type'];
$field1 = $responce['field1'];

if($type == "COLLOCTION"){
$agent_id = substr($field1, 4, 15);
} else{
$agent_id = substr($field1, 4, 15);
}

$tnxid = $responce['tnxid'];
$amount = $responce['amount'];
$payer_via = $responce['field2'];

$rupiso_log = [
'agent_id' => $agent_id,
'tnxid' => $tnxid,
'responce' => $cryptedText
];


$rupisoModel = new \App\Models\RupisoModel();
        $query = $rupisoModel->insert($rupiso_log);

}


}


?>


Please help to clear the issue..
Reply


Messages In This Thread
RE: ErrorException Trying to access array offset on value of type null - by digindia - 06-24-2022, 03:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB