소스 검색

fix http post header

stanley-king 6 년 전
부모
커밋
63891a6340
3개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. 2 3
      core/framework/function/http.php
  2. 0 2
      helper/request_helper.php
  3. 7 0
      test/TestTalk.php

+ 2 - 3
core/framework/function/http.php

@@ -83,12 +83,11 @@ function http_post_data($url, $body, $headers = array())
     curl_setopt($ci, CURLOPT_POSTFIELDS, $body);
     curl_setopt($ci, CURLINFO_HEADER_OUT, TRUE);
     curl_setopt($ci, CURLOPT_URL, $url);
+
     if (!empty($headers)) {
-        $val = implode(',',$headers);
-        Log::record("post oms header={$val}",Log::DEBUG);
         curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
     }
-
+    
     $response = curl_exec($ci);
     if($response == false) {
         $err = curl_error($ci);

+ 0 - 2
helper/request_helper.php

@@ -212,8 +212,6 @@ class request_helper
         foreach ($fields as $field) {
             $param = fcgi_getparam($field);
             $_SERVER[$field] = $param;
-
-            Log::record("{$field}={$param}",Log::DEBUG);
         }
     }
 

+ 7 - 0
test/TestTalk.php

@@ -14,6 +14,8 @@ require_once(BASE_ROOT_PATH . '/helper/room/factory_client.php');
 require_once(BASE_ROOT_PATH . '/helper/room/proto_type.php');
 require_once(BASE_ROOT_PATH . '/helper/room/room_info.php');
 require_once(BASE_ROOT_PATH . '/helper/room/author.php');
+require_once (BASE_CORE_PATH . "/framework/function/http.php");
+
 
 class TestTalk extends PHPUnit_Framework_TestCase
 {
@@ -75,4 +77,9 @@ class TestTalk extends PHPUnit_Framework_TestCase
         $content = base64_decode($data);
         $val = json_decode($content,true);
     }
+    public function testTalklist()
+    {
+        $x = http_post_data("http://a.lrlz.com/mobile/index.php",'act=member_talk&op=talks',['Client-Type: ios','Client-Version: 3.4']);
+        $x = http_post_data("http://192.168.0.200/mobile/index.php",'act=member_talk&op=talks',['Client-Type: ios','Client-Version: 3.4']);
+    }
 }