最近又一个客户让我帮弄一下客客威客的短信接口,关于客客威客的短信接口的修改,短信接口用的是56短信网短信接口(http://www.56dxw.com),采用的是httpMd5加密接口,程序已经调试通过,现在分享给大家,如果在不明白可以加微信:jjzaihaozhe

1.首先在安装插件或修改代码的,先备份把您要修改或替换的文件进行备.

2.编写调用短信接口的核实代码(Dxw56Sms.php),代码如下:

<?php/*** Created by PhpStorm.* User: lenovo* Date: 2016/5/30* Time: 12:48*/
class Dxw56Sms
{const URL = 'http://jiekou.56dxw.com/';public static function sendSms($userName, $password, $mobile='', $content=''){$password = md5($password);$content =urlencode(mb_convert_encoding($content, 'gbk' ,'utf-8'));$sendUrl = self::URL . 'sms/HttpInterfaceMoreMd5.aspx?username='.$userName.'&userpwd='.$password.'&handtel='.$mobile.'&sendtime=&smsnumber=10690&comid=462&sendcontent='.$content;$ret = file_get_contents($sendUrl);if (1!= $ret) {return false;}return true;}
}

3.找到网站中的keke_msg_class.php文件,目录:\lib\inc,用以下代码替换,代码如下:

<?php
keke_lang_class::load_lang_class('keke_msg_class');
require (dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Dxw56Sms.php');
class keke_msg_class {public $_key;public $_k;public $_v=array("send_sms"=>null,"send_email"=>null,"send_mobile_sms"=>null);public $_title;public $_config;public $_uid;public $_username;public $_sitename;public $_normal_content;public $_mobile_content;public $_email;public $_mobile;public $_type;public $_basicconfig;function __construct() { $this->basic_init ();}function basic_init() {global $_lang;global $basic_config;$this->_basicconfig = $basic_config;$this->_key = array ();$this->_title = $_lang['msg_notice'];$this->_k = "";$this->_sitename = $basic_config ['website_name'];}function config_init($k) {$this->_k = $k;$this->_config = db_factory::get_one ( " select * from " . TABLEPRE . "witkey_msg_config where k='$k'" );$this->_v = unserialize ( $this->_config ['v'] );}function setUid($uid) {$this->_uid = $uid;}function setUsername($username) {$this->_username = $username;}function setTitle($title) {$this->_title = $title;}function setType($type) {$this->_type = $type;}function setEmail($email) {$this->_email = $email;}function setValue($key, $value) {$this->_key [$key] = $value;}function setMobile($str_mobile) {$this->_mobile = $str_mobile;}function validate($k) {$this->config_init ( $k );if(is_array( $this->_v)){if (array_sum ( $this->_v ) <= 0) {return false;} else {return true;}}}function send() {if (! $this->_uid) {return false;}if (! $this->validate ( $this->_k )) {return false;}$this->pregmessage ( $this->_k );$sum = array_sum ( $this->_v );switch ($sum) {case 1 :($this->_v ['send_sms'] == 1) and $this->sendmessage ();(isset($this->_v ['send_email'])&& $this->_v ['send_email']== 1) and $this->sendmail ();(isset($this->_v ['send_mobile_sms'])&& $this->_v ['send_mobile_sms'] == 1) and $this->send_phone_sms ();break;case 2 :(($this->_v ['send_sms'] == 1 && $this->_v ['send_email'] == 1)) and ($this->sendmessage () or $this->sendmail ());(($this->_v ['send_sms'] == 1 && $this->_v ['send_mobile_sms'] == 1)) and ($this->sendmessage () or $this->send_phone_sms ());(($this->_v ['send_mobile_sms'] == 1 && $this->_v ['send_email'] == 1)) and ($this->sendmail () or $this->send_phone_sms ());break;case 3 :$this->sendmessage ();$this->sendmail ();$this->send_phone_sms ();break;}$this->_key = array ();}private function getmessagetpl() {global $_cache_obj;$tpl = $_cache_obj->get ( "msg_tpl_" . $this->_k . "_cache" );if (! $tpl) {$objMsgConfig = new Keke_witkey_msg_config_class();$objMsgConfig->setWhere("k='$this->_k'");$tpl = $objMsgConfig->query_keke_witkey_msg_config();$_cache_obj->set ( "msg_tpl_" . $this->_k . "_cache", $tpl );}return $tpl;}private function pregmessage() {$tpl = $this->getmessagetpl ();if (! $this->_username) {$userinfo = kekezu::get_user_info ( $this->_uid );$this->_username = $userinfo ['username'];}$cont0 = $tpl [0] ['content'];$cont0 = $this->tpl_format ( $cont0 );$this->_normal_content = $cont0;$cont1 = $tpl [0] ['mobile_content'];$cont1 = $this->tpl_format ( $cont1 );$this->_mobile_content = $cont1;}private function tpl_format($content) {global $_lang;$this->_username and $cont = str_replace ( '{' . $_lang['username'] . '}', $this->_username, $content );$this->_uid and $cont = str_replace ( '{' . $_lang['user_id'] . '}', $this->_uid, $cont );$this->_sitename and $cont = str_replace ( '{' . $_lang['website_name'] . '}', $this->_sitename, $cont );foreach ( $this->_key as $k2 => $v2 ) {$cont = str_replace ( '{' . $k2 . '}', $v2, $cont );}return $cont;}private function sendmessage() {$message_obj = new Keke_witkey_msg_class ();$message_obj->setTitle ( $this->_title );$message_obj->setContent ( $this->_normal_content );$message_obj->setTo_uid ( $this->_uid );$message_obj->setTo_username ( $this->_username );$message_obj->setType ( $this->_type );$message_obj->setOn_time ( time () );$res = $message_obj->create_keke_witkey_msg ();}public function sendmail() {global $_K;if (! $this->_email || ! $this->_username) {$userinfo = kekezu::get_user_info ( $this->_uid );$this->_username = $userinfo ['username'];$this->_email = $userinfo ['email'];}if (! $this->_email) {return false;}$this->_basicconfig and $basicconfig = $this->_basicconfig or $basicconfig = kekezu::get_config ( 'basic' );if ($basicconfig ['mail_server_cat'] == 'mail') {if ($basicconfig ['post_account'] && $basicconfig ['mail_replay'] && $this->_email && $this->_title && $this->_normal_content) {$hearer = "From:{$basicconfig['post_account']}\nReply-To:{$basicconfig['mail_replay']}\nX-Mailer: PHP/" . phpversion () . "\nContent-Type:text/html";mail ( $this->_email, $this->_title, htmlspecialchars_decode($this->_normal_content), $hearer );}} else if ($basicconfig ['smtp_url'] && $basicconfig ['mail_server_port'] && $basicconfig ['post_account'] && $basicconfig ['account_pwd'] && $basicconfig ['website_name']) {kekezu::send_mail ( $this->_email, $this->_title, htmlspecialchars_decode($this->_normal_content) );}}public function send_phone_sms( $mobiles = '', $tar_content = '') {global $basic_config;if($basic_config['sms_interface'] != 'open'){return false;}$res = db_factory::query('select * from ' . TABLEPRE . 'witkey_basic_config where type="mobile"');if (empty($res)) {return false;}$res = $this->getUserInfo($res);if (empty($res)) {return false;}!$mobiles and $mobiles = $this->_mobile;!$tar_content and $tar_content = $this->_mobile_content;$tar_content = strip_tags(htmlspecialchars_decode($tar_content));return Dxw56Sms::sendSms($res['username'], $res['password'], $mobiles, $tar_content);}private function getUserInfo($res){$retArr = array();foreach ($res as $item) {if ('mobile_username' == $item['k']) {$retArr['username'] = $item['v'];} else if ('mobile_password' == $item['k']) {$retArr['password'] = $item['v'];} else {continue;}}if (!isset($retArr['username']) || !isset($retArr['password'])) {return false;}return $retArr;}public function send_message($uid, $username, $action, $title, $v_arr = array(), $email = null, $mobile = null,$type=null) {if ($this->validate ( $action )) {$this->setUid ( $uid );$this->setUsername ( $username );$this->setEmail ( $email );$this->setMobile ( $mobile );$this->setType ( $type ?$type:'2');foreach ( $v_arr as $k => $v ) {$this->setValue ( $k, $v );}$this->setTitle ( $title );$this->send ();}}public static function send_private_message($title, $tar_content, $to_uid, $to_username, $url = '', $output = 'normal') {global $uid, $username;global $_lang;if (CHARSET == 'gbk') {$title = kekezu::utftogbk ( $title );$tar_content = kekezu::utftogbk ( $tar_content );$to_username = kekezu::utftogbk ( $to_username );}$msg_obj = new Keke_witkey_msg_class ();$msg_obj->_msg_id = null;$msg_obj->setUid ( $uid );$msg_obj->setUsername ( $username );$msg_obj->setTitle ( $title );$msg_obj->setTo_uid ( $to_uid );$msg_obj->setTo_username ( $to_username );$msg_obj->setContent ( $tar_content );$msg_obj->setOn_time ( time () );$msg_obj->setType(2);return  $msg_obj->create_keke_witkey_msg ();}public static function notify_user($uid, $username, $action, $title, $v_arr = array(),$type=null) {$msg_obj = new keke_msg_class ();$contact = self::get_contact ( $uid );if(!$username) $username = $contact['username'];$msg_obj->send_message ( $uid, $username, $action, $title, $v_arr, $contact ['email'],$contact ['mobile'],$type);}public static function get_contact($uid) {return db_factory::get_one ( sprintf ( " select `username`,mobile,email from %switkey_space where uid = '%d'", TABLEPRE, $uid ) );}
}

3.现在的短信必须加上签名,如果您想修改自己网站的签名,文件名:keke_auth_mobile_class.php 目录:\lang\cn\public,也可以修改一下发送的短信内容.如图

4.全局配置 -> 短信接口,开启并添写短信接口用户名,密码,如图

5.根据需要开启相应的发送短信功能,如图:

6.开启之后,就可以实现短信的发送了,比如:对会员中心手机进行认证,手机认证成功后,提示如图所示:

在这里之所以把代码给大家贴出来,是为了更加灵活的适用于各个版本,其实不论那个版本,做相应的修改是就可以了,还是非常简单的,当然,如果各位朋友还有不明白的,可以加我微信:jjzaihaozhe

可能写的还有一些不足之后,也欢迎大家批评,共同讨论啊,哈。。

客客威客短信接口修改(kppw) 配置相关推荐

  1. TourEx旅游网站管理系统短信接口修改

    TourEx旅游网站管理系统短信接口的修改,这个还是很简单的,在这儿一块给大家讲一下. 首先我们要知道在那设置短信接口 系统设置 - 基本设置 - 短信发送设置: 在短信接口中填写就可以了,如: ht ...

  2. destoon 短信发送函数及短信接口修改

    // $DT在common.inc.php中定义, $CACHE = cache_read('module.php'); $DT = $CACHE['dt'];  从缓存里读取网站配置信息. //$d ...

  3. layui 登录页面样式+短信接口

    备注:原代码使用的是阿里某短信接口,代码配置跟具体接口文档有关 <body><h1>物料登录</h1><div class="container w ...

  4. ecshop小京东短信接口插件修改-v41,42,43,50+图片说明

    今天遇到一个老客户,说短信太慢,它问我如何把短信接配置或设置一下短信商,使短信发送速度更加快,它说的配置或设置你在这儿得理解成修改的意思,我看了一下它的程序,版本是ecshop小京东v4.2版本的,它 ...

  5. destoon短信接口源码修改

    destoon是一块非常不错的程序,功能非常的强大,而且seo功能也还不错,但destoon只接了自己的短信接口, 但我一直用的是56短信网短信接口的,而且剩余的条数还不少,所以就想修改一下短信接口, ...

  6. PHPCMS短信接口替换

    PHPCMS V9采用PHP5+MYSQL做为技术基础进行开发.V9采用OOP(面向对象)方式进行基础运行框架搭建.模块化开发方式做为功能开发形式.框架易于功能扩展,代码维护,优秀的二次开发能力,可满 ...

  7. niushop商城系统短信接口替换

    Niushop是一款基于thinkphp5.0 MVC+service框架的开源软件,方便二次开发与集成,今天我就来分享一下,如何进行二次开发.我以替换短信接口为例,一步一步的手把手教大家开发过程,我 ...

  8. C++对接验证码短信接口DEMO示例

    C++对接验证码短信接口DEMO示例 本文为您提供了C++版本的验证码短信接口对接DEMO示例 //接口类型:互亿无线触发短信接口,支持发送验证码短信.订单通知短信等. // 账户注册:请通过该地址开 ...

  9. JAVA短信接口代码,实现发送短信验证码

    短信验证码被广泛应用在网站.app应用中的用户注册.密码找回等场景,那么如何实现发送短信验证码?下面以java开发语言为例,秒赛平台小编为大家分享想调用短信接口的代码. package test; i ...

最新文章

  1. 香港科技大学谢知遥教授实验组招收机器学习全奖博士生
  2. 项目的命名规范,为以后的程序开发中养成良好的行为习惯
  3. Privoxy shadowscocks代理
  4. 【MapBox】5种地图(底图)样式自由切换附源码
  5. SpringBoot配置@PropertySource、@ImportResource、@Bean注解
  6. es6—变量的解构赋值
  7. Tmk吃汤饭(模拟)
  8. 类的加载过程(来一个通俗易懂的理解)
  9. H3C 路由过滤与路由引入
  10. 利用grep-console插件使Intellij idea显示多颜色调试日志
  11. hough变换是如何检测出直线和圆的?
  12. 第二空间计算机最新破解,雨过天晴海外版 电脑时光机 - RollBack Rx v10.2.2699597837 多国语言特别版...
  13. 【电子学会】2021年12月图形化四级 -- 棕熊大战
  14. android倒计时功能,Android 倒计时的五种实现方式
  15. week9 day1 HTML简介和常用标签
  16. [JS] 省市区三级联动(行政区划代码更新至2015-9-30)
  17. Java中append方法和add方法的区别
  18. speedoffice(Excel)怎么给文字加粗
  19. 图像处理中 光场(Light Field)简介及理解
  20. 从小数据量 MySQL 迁移数据到 TiDB

热门文章

  1. 微信撤回消息服务器还有存底么,真得有“后悔药”吗? 微信消息撤回解析
  2. 【历史上的今天】8 月 22 日:改变世界的程序员们
  3. 【Web 技术】818- 一文带你层层解锁「文件下载」的奥秘
  4. 口袋之旅html5超强账号,口袋之旅好号和密码
  5. HTTP网络连接相关知识整理(三):网络错误异常
  6. mysql日志文件名字_MySQL各类日志文件相关变量介绍
  7. html5中平铺图片,HTML布局排版2 div的和图片平铺方便管理
  8. java分类读txt里面的数据_java分别读取两个txt文件里的数据再进行比较。再分别列出这两个文件中共有的和分别独有的数据。...
  9. 金属表面酸洗废水除锰除铬过滤装置,除铬树脂
  10. 计算机网络(第7版) - 第五章 运输层 - 习题