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
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";//開通服務(wù)后 買家中心-查看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"=>"未設(shè)置登陸密碼,請使用短信驗證碼登陸!"); }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";//開通服務(wù)后 買家中心-查看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
I put the source code directly on the Lanzuo network disk. Could you please help me to take a look?
Download the source code