使用 codeingiter 发送短信,错误 "Some Parameter are missing : sender"
send sms using codeingiter, error "Some Parameter are missing : sender"
这是我在 codeigniter 中的控制器。
我可以打印 post 数据,但是当我发送时,出现此错误:
"Some Parameter are missing : sender"
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;
}
Some Parameter are missing : sender
这不是编程错误。这是来自您的短信 API 的回复。因此,只需检查您的 SMS API 的文档,看看这条消息的含义是什么。我认为您在 API 调用期间缺少一些必需的参数。
这是我在 codeigniter 中的控制器。
我可以打印 post 数据,但是当我发送时,出现此错误:
"Some Parameter are missing : sender"
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;
}
Some Parameter are missing : sender
这不是编程错误。这是来自您的短信 API 的回复。因此,只需检查您的 SMS API 的文档,看看这条消息的含义是什么。我认为您在 API 调用期间缺少一些必需的参数。