NiuShop_B2B2短信接口修改,56短信插件目前适用于市场上所有的商城、CMS、手机APP、网站等,无论您的程序是那个版本,您在修改中或调到短信接口中遇到问题可以随时联系我们技术人员,微信QQ:826585910,我们将为您提供免费的技术支持,如果您对代码不懂,可以联系我们技术人员帮您免费接入调试。
接入说明:
1:后台-平台-基础设置-邮箱短信->配置-填写56短信网账号和密码,开启并填写需要的短信模版。
2.后台-注册与访问,选择手机注册。
3.Linux环境请设置插件文件的读写权限(777)
4.核心文件:application/common.php 核心代码
function aliSmsSend($appkey, $secret, $signName, $smsParam, $send_mobile, $template_code, $sms_type = 0)
{
$smsParam=json_decode($smsParam,true);
$content = strtr($template_code,$smsParam);//替换模板中的变量
$contents = $content;
$url = 'http://jiekou.56dxw.com/sms/webinterface.aspx';
$result = file_get_contents($url);
$result = xml_to_array($result);
return $result['SubmitResult']['msg'];
}
//将 xml数据转换为数组格式。
function xml_to_array($xml){
$reg = "/<(\w+)[^>]*>([\\x00-\\xFF]*)<\\/\\1>/";
if(preg_match_all($reg, $xml, $matches)){
$count = count($matches[0]);
for($i = 0; $i < $count; $i++){
$subxml= $matches[2][$i];
$key = $matches[1][$i];
if(preg_match( $reg, $subxml )){
$arr[$key] = xml_to_array( $subxml );
}else{
$arr[$key] = $subxml;
}
}
}
return $arr;
}