我有一个用 codeigniter php 完成的网站,我想在其中向用户发送短信,普通的 php curl 在 phpsanbox 或我的本地工作正常,现在我将其添加到我的 codeigniter 模型中,如下所示:
public function sendOtptoCustomer($mobile,$customerMessage,$temp_id){
$url = "http://dstri.connectbind.com:8443/sendsms/bulksms?username=xxxxx&password=xxxxx&type=0&dlr=1&destination=".$mobile."&source=xxxx&message=".$customerMessage."&entityid=xxxx&tempid=".$temp_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
if (curl_errno($ch)) {
$error_message = curl_error($ch);
var_dump($error_message);
}
curl_close($ch);
}
这里我收到以下错误:
string(72),无法连接到 dstri.connectbind.com 端口 8443 连接被拒绝
任何人都可以告诉我这里可能出了什么问题吗,提前谢谢
//firstly check, curl is enable or not in your apache server, if yes then use this code below or not then enable first then try this
$url = "https://www.smscompanyurl.cm/api/push.json?apikey=apikey&sender=senderId&mobileno=" . urlencode($mobile) . "&text=" . urlencode($smsmsg);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
if (curl_error($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);
return;