1

我正在尝试使用 Clickatell 的 REST api 以编程方式在我的 php 代码中发送 SMS 消息。我有这个代码:

<?php
$message = "Test Message";
$numbers = array("1**********","1**********");
$data = json_encode(array("text"=>$message,"to"=>$numbers));
$authToken = "none of your buisness";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,            "https://api.clickatell.com/rest/message");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST,           1);
curl_setopt($ch, CURLOPT_POSTFIELDS,     $data);
curl_setopt($ch, CURLOPT_HTTPHEADER,     array(
    "X-Version: 1",
    "Content-Type: application/json",
    "Accept: application/json",
    "Authorization: Bearer $authToken"
));

$result = curl_exec ($ch);

echo $result
?>

这一切似乎都有效,因为这是我得到的结果:

{
"data": {
    "message":[
        {
            "accepted":true,
            "to":"1**********",
            "apiMessageId":"e895a0e68089d76fa05f41046a186a70"
        }
    ]
}
}

但是,我的设备上没有收到该消息。这是我可以调试的东西还是超出了我的范围?

4

1 回答 1

4

您返回的 apiMessageId(跟踪代码)并未确认实际交付 - 它仅表示消息已被接受处理。

您似乎使用无法访问美国的帐户向美国发送了一条消息。您可以联系支持团队以帮助您设置/获取允许美国交付的正确帐户。

于 2016-02-03T07:08:37.127 回答