Example #1
-1
 public function postSendsms(Request $request)
 {
     $mobile = Input::get('mobile');
     if (!preg_match("/1[3458]{1}\\d{9}\$/", $mobile)) {
         // if(!preg_match("/^13\d{9}$|^14\d{9}$|^15\d{9}$|^17\d{9}$|^18\d{9}$/",$mobile)){
         //手机号码格式不对
         return parent::returnJson(1, "手机号码格式不对" . $mobile);
     }
     $data = DB::select("select * from members where lifestatus=1 and mobile =" . $mobile);
     if (sizeof($data) > 0) {
         return parent::returnJson(1, "手机号已注册");
     }
     $checkCode = parent::get_code(6, 1);
     Session::put("m" . $mobile, $checkCode);
     $checkCode = Session::get("m" . $mobile);
     Log::error("sendsms:session:" . $checkCode);
     $msg = "尊敬的用户:" . $checkCode . "是您本次的短信验证码,5分钟内有效.";
     // Input::get('msg');
     $curl = new cURL();
     $serverUrl = "http://cf.lmobile.cn/submitdata/Service.asmx/g_Submit";
     $response = $curl->get($serverUrl . "?sname=dlrmcf58&spwd=ZRB2aP8K&scorpid=&sprdid=1012818&sdst=" . $mobile . "&smsg=" . rawurlencode($msg . "【投贷宝】"));
     $xml = simplexml_load_string($response);
     echo json_encode($xml);
     //$xml->State;
     //  <CSubmitState xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
     //   <State>0</State>
     //   <MsgID>1512191953407413801</MsgID>
     //   <MsgState>提交成功</MsgState>
     //   <Reserve>0</Reserve>
     // </CSubmitState>
     // <State>1023</State>
     //  <MsgID>0</MsgID>
     //  <MsgState>无效计费条数,号码不规则,过滤[1:186019249011,]</MsgState>
     //  <Reserve>0</Reserve>
 }