TShopping

標題: OpenCart之手機註冊時手機短信獲取驗證碼相關函數 [打印本頁]

作者: woff    時間: 2014-12-22 15:21
標題: OpenCart之手機註冊時手機短信獲取驗證碼相關函數
  1.    public function Post($curlPost,$url){
  2.       $curl = curl_init();
  3.       curl_setopt($curl, CURLOPT_URL, $url);
  4.       curl_setopt($curl, CURLOPT_HEADER, false);
  5.       curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  6.       curl_setopt($curl, CURLOPT_NOBODY, true);
  7.       curl_setopt($curl, CURLOPT_POST, true);
  8.       curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
  9.       $return_str = curl_exec($curl);
  10.       curl_close($curl);
  11.       return $return_str;
  12.    }
  13.    
  14.    public function xml_to_array($xml){
  15.       $reg = "/<(\w+)[^>]*>([\\x00-\\xFF]*)<\\/\\1>/";
  16.       if(preg_match_all($reg, $xml, $matches)){
  17.          $count = count($matches[0]);
  18.          for($i = 0; $i < $count; $i++){
  19.          $subxml= $matches[2][$i];
  20.          $key = $matches[1][$i];
  21.             if(preg_match( $reg, $subxml )){
  22.                $arr[$key] = $this->xml_to_array( $subxml );
  23.             }else{
  24.                $arr[$key] = $subxml;
  25.             }
  26.          }
  27.       }
  28.       return $arr;
  29.    }
複製代碼







歡迎光臨 TShopping (http://www.tshopping.com.tw/) Powered by Discuz! X3.2