方维团购系统整合云短信网短信平台,方维系统整合短信平台
2013-08-28 15:03
260 查看
方维团购系统默认的短信平台是翼锋短信平台 和 企信通短信平台 ,现在要添加一个云短信平台;
整合后的云短信平台的代码如下:
版权出自:/article/6371201.html ;博主QQ:1006440989
整合后的云短信平台的代码如下:
<?php /*-------------------------------- //add by 方维系统程序员 ,wangtongphp , QQ:1006440989 INSERT INTO `fanwe_sms` VALUES ('22', 'Yun', '云短信网', '', 'http://http.yunsms.cn/tx/', '****', '****', '', '0'); --------------------------------*/ include_once("Sms.class.php"); class YunSms implements Sms { public $message = ""; public $smsInfo; public $statusStr = array( "100" => "发送成功", "101" => "验证失败", "102" => "短信不足", "103" => "操作失败", "104" => "非法字符", "105" => "内容过多", "106" => "号码过多", "107" => "频率过快", "108" => "号码内容空", "109" => "账号冻结", "110" => "禁止频繁单条发送", "111" => "系统暂定发送", "112" => "有错误号码", "113" => "定时时间不对", "114" => "账号被锁,10分钟后登录", "115" => "连接失败", "116" => "禁止接口发送", "117" => "系统升级", ); public function __construct($smsInfo = '') { if(!empty($smsInfo)) { set_time_limit(0); $this->smsInfo = $smsInfo; } } public function sendSMS($mobiles=array(),$content,$sendTime='') { $mobileLen = 50; $mobileList = array_chunk($mobiles,$mobileLen); $content = a_utf8ToGB($content); $contentLen = mb_strlen($content,"GBK"); $smsTotalCount = ceil($contentLen / 70) * count($mobiles); $successNum = 0; $code = ''; foreach($mobileList as $mobileItem) { $mobile = implode(",",$mobileItem); //$http = 'http://http.c123.com/tx/'; $http = $this->smsInfo['server_url']; $data = array ( 'uid'=>$this->smsInfo['user_name'], //用户账号 'pwd'=>strtolower(md5($this->smsInfo['password'])), //MD5位32密码 //'pwd'=>$this->smsInfo['password'], //MD5位32密码 'mobile'=>$mobile, //号码 'content'=>urlencode($content), //内容 //'encode'=>'utf8' ); $code= trim($this->postSMS($http,$data)); //POST方式提交 $smsLog['send_content'] = a_gbToUtf8($content);; $smsLog['action_message'] = $this->statusStr[$code]; $sendCount = count($mobileItem); if($code == "100") { $smsLog['success_mobiles'] = $mobile; $smsLog['fail_mobiles'] = ""; $smsLog['success_count'] = $sendCount; $smsLog['fail_count'] = 0; $smsLog['expense_count'] = ceil($contentLen / 70) * $sendCount; $successNum += $sendCount; } else { $smsLog['success_mobiles'] = ""; $smsLog['fail_mobiles'] = $mobile; $smsLog['success_count'] = 0; $smsLog['fail_count'] = $sendCount; $smsLog['expense_count'] = 0; } $smsLog['send_time'] = a_gmtTime(); if(intval(a_fanweC('SMS_SEND_LOG')) == 1) { $sql = "insert into ".$GLOBALS['db_config']['DB_PREFIX']."sms_send_log (class_name,send_content,success_count,success_mobiles,fail_mobiles,expense_count,fail_count,action_message,send_time) values('C123','".$smsLog['send_content']."','".$smsLog['success_count']."','".$smsLog['success_mobiles']."','".$smsLog['fail_mobiles']."','".$smsLog['expense_count']."','".$smsLog['fail_count']."','".$smsLog['action_message']."','".$smsLog['send_time']."')"; $GLOBALS['db']->query($sql); } } if(($code == "100" && count($mobiles) == 1) || ($smsTotalCount == $successNum)) { $this->message ="成功发送短信【".$content."】,到手机".implode(",",$mobiles); return 1; } else { $this->message = $smsTotalCount."条短信中,有".($smsTotalCount - $successNum)."条未成功发送到手机".implode(",",$mobiles); return 0; } } function postSMS($url,$data='') { $row = parse_url($url); $host = $row['host']; $port = $row['port'] ? $row['port']:80; $file = $row['path']; while (list($k,$v) = each($data)) { $post .= rawurlencode($k)."=".rawurlencode($v)."&"; //转URL标准码 } $post = substr( $post , 0 , -1 ); $len = strlen($post); $fp = @fsockopen( $host ,$port, $errno, $errstr, 10); if (!$fp) { return "$errstr ($errno)\n"; } else { $receive = ''; $out = "POST $file HTTP/1.1\r\n"; $out .= "Host: $host\r\n"; $out .= "Content-type: application/x-www-form-urlencoded\r\n"; $out .= "Connection: Close\r\n"; $out .= "Content-Length: $len\r\n\r\n"; $out .= $post; fwrite($fp, $out); while (!feof($fp)) { $receive .= fgets($fp, 128); } fclose($fp); $receive = explode("\r\n\r\n",$receive); unset($receive[0]); return implode("",$receive); } } } ?>
版权出自:/article/6371201.html ;博主QQ:1006440989
相关文章推荐
- 方维订餐系统整合短信平台,方维系统短信接口开发
- 方维o2o系统 整合短信平台
- C#.NET 大型通用信息化系统集成快速开发平台 4.1 版本 - 忘记密码功能改进、手机短信、电子邮件
- 基于Redis架构的短信平台系统
- 仿Live800做的带客服端winform软件的在线咨询系统,asp.net,利用PowerTalkBox以及整合anget精灵以及speech语音提示+飞信短信提示服务
- ESB (三) 整合跨平台、异构系统的Web Service服务
- pushserver Android平台短信推送系统
- ESB (三) 整合跨平台、异构系统的Web Service服务
- 各种智能平台的调用系统短信发送的方法
- 调用阿里云短信服务平台API实现ERP系统短信发送功能
- 整合Activiti Modeler到业务系统(或BPM平台)
- 电子商务平台最土团购系统和discuz(ucenter)会员整合的详细步骤说明
- 整合Activiti Modeler到业务系统(或BPM平台)
- 方维订餐系统短信接口开发,短信接口开发文档
- C#.NET 大型信息化系统集成快速开发平台 - 手机短信开发接口 4.0
- destoon系统 接入第三方短信平台
- Fanwe 方维P2P系统接入手机短信功能--支持注册验证、资金变动提醒、投标提醒等
- 短信接口平台应用于费用催缴系统提高整体效率
- Zabbix监控整合OneAlert报警平台实现邮件、短信、微信、电话多方式报警
- Fanwe 方维P2P系统(3.0版本)接入手机短信功能--支持注册验证、资金变动提醒、投标提醒等