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

一、安装方法
1.将IHUYI_sms.php文件上传到system/sms/目录下

2.在后台邮件短信->短信平台列表->安装->修改帐号密码

二、账户申请及接口下载

1.短信账户申请地址: http://www.ihuyi.com/product.php  

2.接口文件下载地址:http://www.ihuyi.com/upload/file/cu-fa-jie-kou.rar;请仔细阅读《接口文档--必须看!!!!.doc》。
3.完整代码下载:http://www.ihuyi.com/upload/file/FanWe CMS2.7.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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值