在我的控制器中我有
public function msgStatus(){
$this->load->library('clickatell_rest');
$this->clickatell_rest->getMsgStatus();
}
clickatell rest library class
public function getMsgStatus(){
$msgId = "message ID here";
$authToken = urlencode("token here");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.clickatell.com/rest/message/$msgId");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"X-Version: 1",
"Accept: application/json",
"Authorization: Bearer $authToken"
));
$result = curl_exec ($ch);
print_r($result); exit();
return $result;
}`
当我执行代码时,虽然我的凭据是正确的,但显示以下错误
{ “错误”:{ “代码”: “001”, “描述”:“认证 失败”, “文档”: “http://www.clickatell.com/help/apidocs/error/001.htm”}}
我希望我的代码返回一个消息状态(即如果消息排队,失败,传递给接收者等)