TShopping

 找回密碼
 註冊
搜索
查看: 2232|回復: 0

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

  [複製鏈接]
發表於 2014-12-22 15:21:14 | 顯示全部樓層 |閱讀模式
 
Push to Facebook
  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.    }
複製代碼



 

臉書網友討論
*滑块验证:
您需要登錄後才可以回帖 登錄 | 註冊 |

本版積分規則



Archiver|手機版|小黑屋|免責聲明|TShopping

GMT+8, 2024-3-29 05:56 , Processed in 0.077873 second(s), 22 queries .

本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表