Fanwe 方维P2P系统(3.0版本)接入手机短信功能--支持注册验证、资金变动提醒、投标提醒等

来源:互联网 发布:desmume mac版 编辑:程序博客网 时间:2024/05/17 07:09
一、安装方法
1.将IHUYI_sms.php文件上传到system/sms/目录下
2.在后台邮件短信->短信平台列表->安装->修改帐号密码
二、账户申请及接口下载
1.短信账户申请地址:http://www.ihuyi.com/product.php?cid=33 

2.接口文件下载地址:http://www.ihuyi.com/upload/file/cu-fa-jie-kou.rar;请仔细阅读《接口文档--必须看!!!!.doc》。 

3.完整代码下载:http://www.ihuyi.com/upload/file/FanWe CMS3.0.rar

三、注意事项
1、覆盖文件之前,请事先做好备份
2、免费调试期间,请按照《接口文档--必须看!!!!.doc》的说明,用系统默认模板进行调试。

3、成为正式用户之后方可发送您指定的短信内容。

四、代码

<?php// +----------------------------------------------------------------------// | Pule 普乐信贷借贷系统// +----------------------------------------------------------------------// | Copyright (c) 2010 http://pulecredit.com All rights reserved.// +----------------------------------------------------------------------// | 短信接口自助免费申请:http://www.ihuyi.com/product.php// +----------------------------------------------------------------------$sms_lang = array('format'=>'返回格式',);$config = array('format'=>'xml',);/* 模块的基本信息 */if (isset($read_modules) && $read_modules == true){    $module['class_name']    = 'IHUYI';    /* 名称 */    $module['name']    = "互亿无线短信平台";    $module['lang']  = $sms_lang;    $module['config'] = $config;    $module['server_url'] = 'http://106.ihuyi.cn/webservice/sms.php?method=Submit';    return $module;}// 企信通短信平台require_once APP_ROOT_PATH."system/libs/sms.php";  //引入接口class IHUYI_sms implements sms{public $sms;public $message = "";       public function __construct($smsInfo = '')    {     if(!empty($smsInfo)){$this->sms = $smsInfo;}    }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] = $this->xml_to_array( $subxml );}else{$arr[$key] = $subxml;}}}return $arr;}public function sendSMS($mobile_number,$content){if(is_array($mobile_number)){$mobile_number = implode(",",$mobile_number);}$params = array("account"=>$this->sms['user_name'],"password"=>$this->sms['password'],"mobile"=>$mobile_number,"content"=>urlencode(iconv("utf-8","gbk",$content)),//"format"=>$this->sms['config']['format']);    // 短信接口帐户申请:http://www.ihuyi.com/product.php$params = "account=".$this->sms['user_name']."&password=".$this->sms['password']."&mobile=".$mobile_number."&content=".urlencode(iconv("utf-8","gbk",$content));$result = $this->Post($params,$this->sms['server_url']);$smsStatus = $this->xml_to_array($result);$code = $smsStatus['SubmitResult']['code'];if($code==2){$result['status'] = 1;}else{$result['status'] = 0;$result['msg'] = $smsStatus['SubmitResult']['msg'];}return $result;}public function getSmsInfo(){return "互亿无线短信平台";}public function check_fee(){$params = "account=".$this->sms['user_name']."&password=".$this->sms['password'];$url = "http://106.ihuyi.cn/webservice/sms.php?method=GetNum";$result = $this->Post($params,$url);$results = $this->xml_to_array($result);$str = "互亿无线短信平台,剩余:".$results['GetNumResult']['num']."条";return $str;}function Post($curlPost,$url){$curl = curl_init();curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_HEADER, false);curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);curl_setopt($curl, CURLOPT_NOBODY, true);curl_setopt($curl, CURLOPT_POST, true);curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);$return_str = curl_exec($curl);curl_close($curl);return $return_str;}}?>


0 0
原创粉丝点击