我用来发送消息的代码工作正常。由于clickatell服务器给出200响应,因此我已正确配置了Web挂钩,这意味着我的系统已收到回调,但未捕获到回调信息。我对此还很陌生,所以我可能做错了什么。 clickatell library
CONTROLER-通过电子邮件发送回叫结果(我正在接收电子邮件,但没有回叫结果)
public function callback(){
$this->load->library('clickatell_rest'); //Load Clickatell library
$this->clickatell_rest->parseStatusCallback(function ($result){
$callbackRunDate = date('Y-m-d H:i:s');
$from_email = 'admin@aaa.co.za';
$to = 'sebakets@gmail.com';
$message = $callbackRunDate.' '.print_r($result);
$subject = 'Callback Results';
$this->email->set_mailtype('html');
$this->email->from($from_email, 'Clickatell');
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($message);
$this->email->send();
});
}
Clickatell库功能
public static function parseStatusCallback($callback, $file = STDIN){
$body = file_get_contents($file);
$body = json_decode($body, true);
$keys = [
'apiKey',
'messageId',
'requestId',
'clientMessageId',
'to',
'from',
'status',
'statusDescription',
'timestamp'
];
if (!array_diff($keys, array_keys($body))) {
$callback($body);
}
return;
}