ECmall短信接口修改,56短信接口目前适用于市场上所有的商城、CMS、手机APP、网站等,无论您的程序是那个版本,您在修改中或调到短信接口中遇到问题可以随时联系我们技术人员,微信QQ同号:QQ:826585910,我们将为您提供免费的技术支持,如果您对代码不懂,可以联系我们技术人员帮您免费接入调试。
1.网站-短信管理,填写56短信网的账号和密码
2.打开ecmall\includes\libraries\mobile_msg.lib.php 核心代码
function send_msg($user_id, $user_name, $to_mobile, $smsText) {
//互亿无线发送短信
$target = 'http://jiekou.56dxw.com/sms/webinterface.aspx';
$post_data = "username=".SMS_UID."&userpwd=".SMS_KEY."&handtel=".$to_mobile."&sendcontent=".rawurlencode($smsText);
$res = $this->xml_to_array($this->Post($post_data, $target));
$add_msglog = array(
'user_id' => $user_id,
'user_name' => $user_name,
'to_mobile' => $to_mobile,
'content' => $smsText,
'state' => $res,
'time' => gmtime(),
);
$this->_msglog_mod->add($add_msglog);
if ($res['SubmitResult']['code']==2) {
// user_id = 0 user_name = admin 表示为系统发送,短信的条数不做操作
if ($user_id != 0) {
$this->_msg_mod->edit('user_id=' . $user_id, 'num=num-1');
}
return TRUE;
} else {
return FALSE;
}
}
//请求数据到短信接口,检查环境是否 开启 curl init。
function Post($curlPost,$url){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
$return_str = curl_exec($curl);
curl_close($curl);
return $return_str;
}