destoon短信接口修改方法

destoon是很优秀的B2B行业站程序。程序模块化开发契合度很高,二次开发起来也很顺畅。数据缓存,权限分配,SEO功能方面都不错。

但是在使用这套程序的时候,常常要用到发送短信的功能,而destoon本身只接入了自己的短信接口。一些初接触destoon的开发者不知道如何修改。

所以铁牛特此写个文档分享如何修改destoon如何接入外部短信接口。

第一步:找到/include/global.func.php文件,搜索函数send_sms

修改function send_sms为function send_sms_back,新建函数send_sms

function send_sms($mobile, $message, $word = 0, $time = 0){
    global $db, $DT, $DT_TIME, $DT_IP, $_username;
    if(!$DT['sms'] || !$DT['sms_uid'] || !$DT['sms_key']) return false;
    $sms_url = 'http://app.com/test/sms.php';//你的短信接口地址
    //例如你的短信接口是http://app.com/test/sms.php?username=athena&pwd=123456&mobile=15889726201&msg=我的测试短信内容
    
    $word or $word = word_count($message);
    $sms_message = rawurlencode(convert($message, DT_CHARSET, 'UTF-8'));
    //data是你的url字符串 例如:username=athena&pwd=123456&mobile=15889726201&msg=我的测试短信内容
    $data = 'username='.$DT['sms_uid']
    . '&pwd='.$DT['sms_key']
    . '&mobile='.$mobile
    . '&msg='.$sms_message;
    
//采用PHP的cURL库推送网页 
$cur = curl_init($sms_url);
curl_setopt($cur, CURLOPT_POST, 1);
curl_setopt($cur, CURLOPT_POSTFIELDS, $data);
curl_setopt($cur, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($cur, CURLOPT_HEADER, 0);
curl_setopt($cur, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($cur, CURLOPT_RETURNTRANSFER, 1);
$rec = curl_exec($cur);
curl_close($cur);
$code='';
if(!$rec==$DT['sms_ok']){
    $code = 'Can Not Connect SMS Server';
}
else{
    $code =$DT['sms_ok'];
}

$db->query("INSERT INTO {$db->pre}sms (mobile,message,word,editor,sendtime,code) VALUES ('$mobile','$message','$word','$_username','$DT_TIME','$code')");

    return $code;    
}


 

第二步:设置短信返回值

我的短信接口地址是:http://app.com/test/sms.php,如果短信发送成功,信息是success,这个发送成功的信息需要在destoon管理后台去设置

 

 

 

 

提示:如果你的curl_init()函数不可用

找到找到php.ini,修改extension=php_curl.dll 把前面的分号去掉
如果你的php库没有php_curl.dll,那么将php_curl.dll php5ts.dlllibeay32.dll ssleay32.dll 复制到 windows/system32下 重启IIS或Apache服务即可。

 

destoon开发交流群号码:98537090

 

  • 0
    点赞
  • 0
    收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值