woff 發表於 2014-12-22 15:21:14

OpenCart之手機註冊時手機短信獲取驗證碼相關函數

   public function Post($curlPost,$url){
      $curl = curl_init();
      curl_setopt($curl, CURLOPT_URL, $url);
      curl_setopt($curl, CURLOPT_HEADER, false);
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($curl, CURLOPT_NOBODY, true);
      curl_setopt($curl, CURLOPT_POST, true);
      curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
      $return_str = curl_exec($curl);
      curl_close($curl);
      return $return_str;
   }
   
   public function xml_to_array($xml){
      $reg = "/<(\w+)[^>]*>([\\x00-\\xFF]*)<\\/\\1>/";
      if(preg_match_all($reg, $xml, $matches)){
         $count = count($matches);
         for($i = 0; $i < $count; $i++){
         $subxml= $matches[$i];
         $key = $matches[$i];
            if(preg_match( $reg, $subxml )){
               $arr[$key] = $this->xml_to_array( $subxml );
            }else{
               $arr[$key] = $subxml;
            }
         }
      }
      return $arr;
   }

頁: [1]
查看完整版本: OpenCart之手機註冊時手機短信獲取驗證碼相關函數