發送驗證碼顯示服務器連接失敗
問題描述
事情是這樣的,我手上一套程序,有一個短信驗證碼功能,現在搭建出來,發送驗證碼顯示這樣
我剛開始以為是修改代碼可能誤刪了某些文件,但是我去找以前能正常使用的源代碼部署出來也是這個效果,短信接口調試都是正常的,唯獨這個點擊發送驗證碼就連接服務器失敗,并且還有一個用戶xia dan短信通知我的,也不會發送了,就很迷,求助大神們看看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));
麻煩各位大神有空幫我看下哪里的問題
問題解答
回答1:下載源代碼
https://weiling.lanzous.com/iJdhXgahmoj
回答2:我直接把源碼放在藍奏網盤了,麻煩大神幫忙看看
下載源代碼
相關文章:
1. mysql 查詢身份證號字段值有效的數據2. python bottle跑起來以后,定時執行的任務為什么每次都重復(多)執行一次?3. 視頻文件不能播放,怎么辦?4. html5 - HTML代碼中的文字亂碼是怎么回事?5. python - 爬蟲模擬登錄后,爬取csdn后臺文章列表遇到的問題6. visual-studio - Python OpenCV: 奇怪的自動補全問題7. mysql - 分庫分表、分區、讀寫分離 這些都是用在什么場景下 ,會帶來哪些效率或者其他方面的好處8. javascript - 彈出一個子窗口,操作之后關閉,主窗口會得到相應的響應,例如網站的某些登錄界面,django后臺的管理等,這是怎么實現的呢?9. javascript - ios返回不執行js怎么解決?10. android - 分享到微信,如何快速轉換成字節數組
