怎样在线开通银行卡短信通知,怎么在手机银行开通短信通知

  

  本文为您提供了服务器端编程语言(专业超文本预处理器的缩写)语言版本的验证码短信接口对接演示示例   

  

  //接口类型:互亿无线触发短信接口,支持发送验证码短信、订单通知短信等。 //账户注册:请通过该地址开通账户http://user.ihuyi.com/?DKimmu//注意事项: //(1)调试期间,请使用用系统默认的短信内容:您的验证码是:【变量】。请不要把验证码泄露给其他人。 //(2)请使用蜜蜂及请求来调用接口,可在会员中心获取;//(3)该代码仅供接入互亿无线短信接口参考使用,客户可根据实际需要自行编写;//开启会话session _ start();标题(' Content-type : text/html;charset=UTF-8 ');//请求数据到短信接口,检查环境是否开启卷曲初始化。函数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,$ curl post);$ return _ str=curl _ exec($ curl);curl _ close($ curl);return $ return _ str} //将可扩展标记语言数据转换为数组格式。函数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=$匹配1 $ I;if(preg_match( $reg,$ subxml)){ $ arr $ key=XML _ to _ array($ subxml);} else { $ arr $ key=$ subxml} } }返回$ arr} //random()函数返回随机整数。function random($length=6,$ number=0){ PHP _ VERSION ' 4。2 .0 ' mt _ srand((double)microtime()* 1000000);if($numeric) { $hash=sprintf('%0 ').$长度. d ',mt_rand(0,pow(10,$ length)-1);} else { $ hash=$ chars=' abcdefghjklmnpqrstuvwxyz 23456789 abcdefghjkmnpqrstuvwxyz ';$ max=strlen($ chars)-1;for($ I=0;一美元长度;$i ) { $hash .=$ chars} } return $ hash}//短信接口地址$ target='http://106.ihuyi.com/webservice/sms.php?方法=提交;//获取手机号$ mobile=$ _ POST“移动”;//获取验证码$ send _ code=$ _ POST 'send _ code//生成的随机数$mobile_code=random(4,1);if(empty($mobile)){ exit('手机号码不能为空');}//防用户恶意请求if(空($_SESSION'send_code ')或$send_code!=$_SESSION'send_code'){ exit('请求超时,请刷新页面后重试');} $post_data='account=用户名密码=密码手机='。$手机。内容='。rawurlencode('您的验证码是:'.$mobile_code .请不要把验证码泄露给其他人。');//查看用户名登录用户中心-验证码通知短信产品总览-API接口信息-apid//查看密码登录用户中心-验证码通知短信产品总览-API接口信息-API key $ gets=XML _ to _ array(Post($ Post _ data,$ target));if($ gets ' submit result ' ' code '==2){ $ _ SESSION ' mobile '=$ mobile;$ _ SESSION ' mobile _ code '=$ mobile _ code;} echo $获取“SubmitResult”消息   

相关文章