destoon短信接口修改方法
2014-03-03 10:32
232 查看
destoon是很优秀的B2B行业站程序。程序模块化开发契合度很高,二次开发起来也很顺畅。数据缓存,权限分配,SEO功能方面都不错。
但是在使用这套程序的时候,常常要用到发送短信的功能,而destoon本身只接入了自己的短信接口。一些初接触destoon的开发者不知道如何修改。
所以铁牛特此写个文档分享如何修改destoon如何接入外部短信接口。
第一步:找到/include/global.func.php文件,搜索函数send_sms
修改function send_sms为function send_sms_back,新建函数send_sms
第二步:设置短信返回值
我的短信接口地址是: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本身只接入了自己的短信接口。一些初接触destoon的开发者不知道如何修改。
所以铁牛特此写个文档分享如何修改destoon如何接入外部短信接口。
第一步:找到/include/global.func.php文件,搜索函数send_sms
修改function send_sms为function send_sms_back,新建函数send_sms
1 function send_sms($mobile, $message, $word = 0, $time = 0){ 2 global $db, $DT, $DT_TIME, $DT_IP, $_username; 3 if(!$DT['sms'] || !$DT['sms_uid'] || !$DT['sms_key']) return false; 4 $sms_url = 'http://app.com/test/sms.php';//你的短信接口地址 5 //例如你的短信接口是http://app.com/test/sms.php?username=athena&pwd=123456&mobile=15889726201&msg=我的测试短信内容 6 7 $word or $word = word_count($message); 8 $sms_message = rawurlencode(convert($message, DT_CHARSET, 'UTF-8')); 9 //data是你的url字符串 例如:username=athena&pwd=123456&mobile=15889726201&msg=我的测试短信内容10 $data = 'username='.$DT['sms_uid']11 . '&pwd='.$DT['sms_key']12 . '&mobile='.$mobile13 . '&msg='.$sms_message;14 15 //采用PHP的cURL库推送网页 16 $cur = curl_init($sms_url);17 curl_setopt($cur, CURLOPT_POST, 1);18 curl_setopt($cur, CURLOPT_POSTFIELDS, $data);19 curl_setopt($cur, CURLOPT_FOLLOWLOCATION, 1);20 curl_setopt($cur, CURLOPT_HEADER, 0);21 curl_setopt($cur, CURLOPT_SSL_VERIFYPEER, 0);22 curl_setopt($cur, CURLOPT_RETURNTRANSFER, 1);23 $rec = curl_exec($cur);24 curl_close($cur);25 $code='';26 if(!$rec==$DT['sms_ok']){27 $code = 'Can Not Connect SMS Server';28 }29 else{30 $code =$DT['sms_ok'];31 }32 33 $db->query("INSERT INTO {$db->pre}sms (mobile,message,word,editor,sendtime,code) VALUES ('$mobile','$message','$word','$_username','$DT_TIME','$code')");34 35 return $code; 36 }
第二步:设置短信返回值
我的短信接口地址是: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服务即可
相关文章推荐
- Shell字符串截取的详细方法
- struts2 配置错误There is no result type defined for type 'json'
- setUID补充
- 功能強大的遠端控制軟體 - (1) UltraVNC
- C/C++开发者必不可少的15款编译器+IDE
- shell中的特殊符号
- IE下的iframe打印时,页面比例变小
- linux的三类用户
- Yarn下的并行计算框架
- Vmware Esxi commands
- openg和VS2010的环境配置
- java中的值传递与引用传递
- 如何在ElementaryOS(Ubuntu 12.10)上搞定娇羞的Lumia920(Win8 phone)
- EL表达式的应用
- iOS 方便的宏定义
- Win7下JDK环境变量的设置
- 如何查看当前运行的系统所调用的全部的dll文件
- 黑客是怎么入侵你的网站
- 《高效学习OpenGL》 之 裁剪测试 alpha测试 glScissor(),glAlphaFunc()
- Python - 字符和字符值之间的转换