codeigniter - 我正在尝试使用 Clickatell 的 php(REST api)跟踪消息的传递状态
问题描述
在我的控制器中,我有
public function msgStatus(){
$this->load->library('clickatell_rest');
$this->clickatell_rest->getMsgStatus();
}
clickatell 休息库类
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 ”}}
我希望我的代码返回消息状态(即,如果消息已排队、失败、已交付给收件人等)
解决方案
推荐阅读
- html - 即使将值更正为有效,自定义验证消息仍然显示无效
- python - 如何使用 Python 创建时间线视觉显示支线分支
- python - 如何在 Gurobi addMConstr 中组合多个术语?
- sql - 如何将“nextval('testing_thing_thing_id_seq'::regclass)”声明为 postgres 表“testing_thing”中列“thing_id”的默认值?
- python - 使用python在hadoop中实现DGIM算法?
- quarkus - AWS Lambda 前面的 Kongo 插件,用于休息 api
- java - 如何获取以 C# 开头的 Java 程序的实时输入/输出
- r - Tableau 中的 R - 如何将 NULL 转换为 0
- arrays - 仅当字符串与条件匹配时才将字符串属性转换为数组
- python - 用于单元测试或 pytest 的 Python 检测