getJOSource(); if ($source != null) { // check if source has a callback url $callback_url = $source->getCallbackURL(); if ($callback_url != null) { // form the body for the callback // jo id and jo status $jo_data = [ 'id' => $jo->getID(), // 'status' => JOStatus::getName($jo->getStatus()), ]; // send status $this->sendJOInfo($jo_data, $callback_url); } } } protected function sendJOInfo($jo_info, $callback_url) { $body = json_encode($jo_info); // error_log(print_r($body, true)); // error_log('Sending json output to ' . $callback_url); $curl = curl_init(); $options = [ CURLOPT_URL => $callback_url, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $body, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', ], ]; curl_setopt_array($curl, $options); $res = curl_exec($curl); curl_close($curl); // check result error_log('Result ' . $res); } }