使用codeingiter发送短信,错误“缺少某些参数:发件人”

时间:2017-05-05 05:00:28

标签: php codeigniter sms

这是我在codeigniter中的控制器。

我可以打印打印发布数据,但是当我发送时,会出现以下错误:

“缺少某些参数:发件人”

public function sendsms(){

    $mobile = $this->input->post('mobile');
    $message = $this->input->post('message');

    $data = $this->input->post();

    $authKey = "********";
    unset($data['submit']);
    $mobilenumber = implode('', $data['mobile']);

    $arr = str_split($mobilenumber, "10");

    $numbers = implode(",", $arr);

    $senderId = "REL";
    $route = 4;

    $postData = array(
        'authkey' => $authKey,
        'mobiles' => $numbers,
        'message' => $message,
        'senderId' => $senderId,
        'route' => $route
            );

    $url = "********";

    $ch = curl_init();

    curl_setopt_array($ch, array(
            CURLOPT_POST => true,
            CURLOPT_URL => $url,
            CURLOPT_POSTFIELDS => $postData,
            CURLOPT_RETURNTRANSFER => true,
    ));


    $output = curl_exec($ch);

    curl_close($ch);

    echo $output;
}

1 个答案:

答案 0 :(得分:0)

Some Parameter are missing : sender这不是编程错误。这是来自您的SMS API的响应。因此,只需查看SMS API的文档,并查看此消息的含义。我认为你在API调用期间缺少一些必需的参数。