search

Home  >  Q&A  >  body text

Sending verification code shows server connection failure

The thing is like this, I have a program that has a SMS verification code function. Now I have built it, and when I send the verification code, it shows like this

O1JRQBMC5AYBOTDVE~B3X(2.png

I thought at first I may have accidentally deleted some files by modifying the code, but I went to find the source code that worked normally before and deployed it with the same effect. The debugging of the SMS interface was normal, except that when I clicked to send the verification code, it failed to connect to the server, and it still failed. There is a user xia dan who notified me via text message but it will not be sent. I am very confused. Please ask the experts to take a look at 555~

 $host = "https://cxkjsms.market.alicloudapi.com";
    $path = "/chuangxinsms/dxjk";
    $method = "POST";
    $appcode = "8324d57716e84d518532ac4631fe6a04";//开通服务后 买家中心-查看AppCode
    $headers = array();
    array_push($headers, "Authorization:APPCODE " . $appcode);
    $bodys = "";
    $url = $host . $path . "?" . $querys;

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_FAILONERROR, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, true);
    if (1 == strpos("$".$host, "https://"))
    {
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    }
    var_dump(curl_exec($curl));
   }//获取手机短信验证码
    elseif($mod == "login"){
        $type = daddslashes($_POST['type']);
        $shouji = daddslashes($_POST['shouji']);
        $pass = daddslashes($_POST['pass']);
        $code = daddslashes($_POST['code']);
        if($results){
            if($results['response'] == 1){
                if($type == 1){
                    if($shouji == "" || $code == ""){
                        $result = array("code"=>-1,"msg"=>"手机号或验证码不能为空!");
                    }elseif(!preg_match("/^1[34578]{1}\d{9}$/",$shouji)){
                        $result = array("code"=>-2,"msg"=>"手机号不合法!");
                    }elseif($code != $_SESSION['code']){
                        $result = array("code"=>-3,"msg"=>"验证码错误!");
                    }else{
                        $result = array("code"=>0,"msg"=>"验证成功,请稍后...");
                        $_SESSION['Mao_login'] = 1;
                        $_SESSION['user'] = $shouji;
                        unset($_SESSION['code']);
                    }
                }elseif($type == 2){
                    $cha_1 = $DB->get_row("select * from mao_user where M_id='{$mao['id']}' and users='{$shouji}' limit 1");
                    if($shouji == "" || $pass == ""){
                        $result = array("code"=>-1,"msg"=>"手机号或密码不能为空!");
                    }elseif(!preg_match("/^1[34578]{1}\d{9}$/",$shouji)){
                        $result = array("code"=>-2,"msg"=>"手机号不合法!");
                    }elseif(!$cha_1){
                        $result = array("code"=>-3,"msg"=>"未设置登陆密码,请使用短信验证码登陆!");
                    }else{
                        if($cha_1['pass'] == $pass){
                            $result = array("code"=>0,"msg"=>"验证成功,请稍后...");
                            $_SESSION['Mao_login'] = 1;
                            $_SESSION['user'] = $cha_1['users'];
                            unset($_SESSION['code']);
                        }else{
                            $result = array("code"=>-4,"msg"=>"登陆密码错误!");
                        }
                    }
                }else{
                    $result=array("code"=>-2000,"msg"=>"非法操作已记录信息!");
                }
            }else{
                $result=array("code"=>-2000,"msg"=>"[{$results['response']}],{$results['err_msg']}");
            }
        }else{
            $result=array("code"=>-2000,"msg"=>"验证失败!");
        }
        exit(json_encode($result));
 $host = "https://cxkjsms.market.alicloudapi.com";
    $path = "/chuangxinsms/dxjk";
    $method = "POST";
    $appcode = "8324d57716e84d518532ac4";//开通服务后 买家中心-查看AppCode
    $headers = array();
    array_push($headers, "Authorization:APPCODE " . $appcode);
    $bodys = "";
    $url = $host . $path . "?" . $querys;

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_FAILONERROR, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, true);
    if (1 == strpos("$".$host, "https://"))
    {
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    }
    var_dump(curl_exec($curl));

Please help me find out where the problem is when you have time

十二泉十二泉1532 days ago2618

reply all(2)I'll reply

  • 十二泉

    十二泉2020-09-02 17:40:26

    Download source code

    https://weiling.lanzous.com/iJdhXgahmoj

    reply
    0
  • 十二泉

    十二泉2020-09-02 17:39:48

    I put the source code directly on the Lanzuo network disk. Could you please help me to take a look?

    Download the source code

    reply
    0
  • Cancelreply