2010-07-30 7 views
3

Zend_HTTP_Client를 사용하여 HTTP 요청을 서버에 보내고 응답을 다시받습니다. 요청을 보내는 서버는 HTTPS 웹 서버입니다. 현재 한 번의 왕복 요청에는 약 10-12 초가 소요됩니다. 요청이 진행되는 웹 서버의 처리 속도가 느려서 오버 헤드가 발생할 수 있음을 알고 있습니다.Zend_HTTP_Client에서 SSL 체크인 건너 뛰기

성능 향상을 위해 CURL처럼 SSL 인증서 확인을 건너 뛸 수 있습니까? 그렇다면 매개 변수를 설정하는 방법은 무엇입니까? 당신이 SSL이 문제가 확신하는 경우 다음 curl을 사용하는 Zend_Http_Client를 구성 할 수 있습니다, 다음 적절한 curl 옵션을 전달,

try 
    { 
     $desturl ="https://1.2.3.4/api"; 

     // Instantiate our client object 
     $http = new Zend_Http_Client(); 

     // Set the URI to a POST data processor 
     $http->setUri($desturl); 

     // Set the POST Data 
     $http->setRawData($postdata); 

     //Set Config 
     $http->setConfig(array('persistent'=>true)); 

     // Make the HTTP POST request and save the HTTP response 
     $httpResponse = $http->request('POST'); 
    } 
    catch (Zend_Exception $e) 
    { 
     $httpResponse = ""; 
    } 

    if($httpResponse!="") 
    { 
     $httpResponse = $httpResponse->getBody(); 
    } 

    //Return the body of HTTTP Response 
    return $httpResponse; 
+0

성능상의 문제점은 무엇입니까? 왜 확실히 알아 내지 못하니? –

답변

6

:

나는 다음과 같은 코드가 있습니다.

http://framework.zend.com/manual/en/zend.http.client.adapters.html

$config = array( 
    'adapter' => 'Zend_Http_Client_Adapter_Curl', 
    'curloptions' => array(CURLOPT_SSL_VERIFYPEER => false), 
); 

$client = new Zend_Http_Client($uri, $config); 

실제로 curl 혹시 필요합니다 거의 모든 옵션이 단지 때문에 curl 어댑터를 사용하는 것이 좋습니다

젠드 정말 좋은 래퍼를 제공한다.