接口文档

 //发送手机验证码
    public function getPhoneVerification(){
        $Phone = isset($_POST['Phone'])?$_POST['Phone']:'';//号码
        if($Phone!=''){
            $crdo=rand(1000,9999);
            $content = "尊敬的用户您好!您正在进行手机验证,验证码:{$crdo},有效期15分钟,如非本人操作,请勿泄露!【公司签名】";
            $url="http://139.196.234.129:8888/sms.aspx?";
            $curlPost = "action=send&userid=85&account=短信平台账号&password=短信平台密码&mobile={$Phone}&content={$content}&sendTime=&extno=";
            $ch = curl_init();
            curl_setopt($ch,CURLOPT_URL,$url);//抓取指定网页
            curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //要求结果为字符串且输出到屏幕上
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);  //允许curl提交后,网页重定向 
            curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
            curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
            $data = curl_exec($ch);//运行curl
            if($data){
                $_SESSION['PhoneCode']=$crdo;
                echo 1;

            }else{
                echo 0;
            }
        }else{
            echo 0;
        }
    }

    //手机验证
    public function phoneVerification(){
        if($_POST['Pcode']==$_SESSION['PhoneCode']){
            echo 1;
        }else{
            echo 0;
        }
    }
?>

扫一扫

扫码关注 · 认证、审核结果通知 · 短信发送结果通知 · 活动及最新平台信息

返回顶部