Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Codeigniter I';我试图从Clickatell使用php(RESTAPI)跟踪消息的传递状态_Codeigniter_Curl_Clickatell - Fatal编程技术网

Codeigniter I';我试图从Clickatell使用php(RESTAPI)跟踪消息的传递状态

Codeigniter I';我试图从Clickatell使用php(RESTAPI)跟踪消息的传递状态,codeigniter,curl,clickatell,Codeigniter,Curl,Clickatell,我的控制器里有 public function msgStatus(){ $this->load->library('clickatell_rest'); $this->clickatell_rest->getMsgStatus(); } 单击ATEL rest库类 public function getMsgStatus(){ $msgId = "message ID here"; $authToken = urlencode

我的控制器里有

public function msgStatus(){
   $this->load->library('clickatell_rest');
   $this->clickatell_rest->getMsgStatus();
} 
单击ATEL rest库类

  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”,“说明”:“身份验证” 失败,“文档”:“}”


我希望我的代码返回消息状态(即,如果消息排队、失败、传递到recepient等)

你确定你应该自己对令牌值进行urlencode吗?即使我省略了urlencode,它也会给我相同的结果,那么一定是出了问题。。。很难说到底是什么,即使是错误消息中指向文档的链接也只会导致404。当然,我不知道我的代码中缺少了什么。你能给我们指出API文档的正确URL吗?