1
從數據庫中讀取這是我的代碼是用來發送短信的手機號碼的手機。我可以將短信發送到多個號碼,但是當我選擇一個號碼時,SMS不會發送。所以我放了一個if else條件來檢查是否只有一個選擇的數字,那麼它不應該有逗號,否則它應該用逗號分隔。但現在SMS不發送到任何數字。出了什麼問題。請幫幫我。無法發送短信與笨
$college = $this->input->post('college');
$count = count($college);
if($count == 1){
$mobiles = implode("" , $_POST['college']);
} else {
$mobiles = implode("," , $_POST['college']);
}
$data = array(
'sms_date' => date('Y-m-d H:i:s'),
'sender' => 'Some Addresss',
'receiver' => $mobiles,
'sms_message' => $this->input->post('message')
);
function curl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
//$mobile = $mobiles;
$username = "*****"; //your username
$password = "*****"; //your password
$sender = "****"; //Your senderid
$username = urlencode($username);
$password = urlencode($password);
$sender = urlencode($sender);
$messagecontent = $this->input->post('message'); //Type Of Your Message
$message = urlencode($messagecontent);
$url="http://****.com/sendsms?uname=".$username."&pwd=".$password."&senderid=".$sender."&to=".$mobiles."&msg=".$message."&route=T";
$response = curl($url);
調用捲曲()函數。只是呼應網址回聲$ URL之前確保大學不是一個空數組 – JYoThI
;出口;並看到一切正確或不正確 – JYoThI