source/Http/CurlTransport.php
public function makeHttpRequest() {
        $url = $this->addUrlData($this->Request->getUrl(), $this->Request->getUrlData());
        $url = $this->addGetData($url, $this->Request->getGetData());
        $Resource = curl_init($url);

        $options = [
            CURLOPT_RETURNTRANSFER  => true,
            CURLOPT_CONNECTTIMEOUT  => $this->Request->getConnectTimeout(),
            CURLOPT_TIMEOUT         => $this->Request->getTimeout(),
            CURLOPT_HEADER          => true,
        ];
        if (!$this->Request->isDefaultSslVersion()) {
            $options[CURLOPT_SSLVERSION] = $this->Request->getSslVersion();
        }
        curl_setopt_array($Resource, $this->getOptions() + $options);

        $this->addHeaders($Resource, $this->Request->getHeaders());
        $this->addPostData($Resource, $this->Request->getPostData());
        $this->setMethod($Resource, $this->Request->getMethod());

        $result = curl_exec($Resource);
        if ($result === false) {
            $errorCode = curl_errno($Resource);
            $errorMessage = curl_error($Resource);
            curl_close($Resource);
            throw new CurlErrorException($errorMessage, $errorCode);
        }

        $headerSize = curl_getinfo($Resource, CURLINFO_HEADER_SIZE);
        $headers = substr($result, 0, $headerSize);
        $this->parseResponseHeaders($headers);

        $body = substr($result, $headerSize);
        $httpCode = curl_getinfo($Resource, CURLINFO_HTTP_CODE);
        curl_close($Resource);
        switch (floor($httpCode / 100)) {
            case 1:
                throw new HttpInformationalCodeException($body, $httpCode);
            case 3:
                throw new HttpRedirectionCodeException($body, $httpCode);
            case 4:
                throw new HttpClientErrorCodeException($body, $httpCode);
            case 5:
                throw new HttpServerErrorCodeException($body, $httpCode);
            default:
            case 2:
                return $body;
        }
    }
public function makeHttpRequest() {
        $url = $this->addUrlData($this->Request->getUrl(), $this->Request->getUrlData());
        $url = $this->addGetData($url, $this->Request->getGetData());
        $Resource = curl_init($url);

        $options = [
            CURLOPT_RETURNTRANSFER  => true,
            CURLOPT_CONNECTTIMEOUT  => $this->Request->getConnectTimeout(),
            CURLOPT_TIMEOUT         => $this->Request->getTimeout(),
            CURLOPT_HEADER          => true,
        ];
        if (!$this->Request->isDefaultSslVersion()) {
            $options[CURLOPT_SSLVERSION] = $this->Request->getSslVersion();
        }
        curl_setopt_array($Resource, $this->getOptions() + $options);

        $this->addHeaders($Resource, $this->Request->getHeaders());
        $this->addPostData($Resource, $this->Request->getPostData());
        $this->setMethod($Resource, $this->Request->getMethod());

        $result = curl_exec($Resource);
        if ($result === false) {
            $errorCode = curl_errno($Resource);
            $errorMessage = curl_error($Resource);
            curl_close($Resource);
            throw new CurlErrorException($errorMessage, $errorCode);
        }

        $headerSize = curl_getinfo($Resource, CURLINFO_HEADER_SIZE);
        $headers = substr($result, 0, $headerSize);
        $this->parseResponseHeaders($headers);

        $body = substr($result, $headerSize);
        $httpCode = curl_getinfo($Resource, CURLINFO_HTTP_CODE);
        curl_close($Resource);
        switch (floor($httpCode / 100)) {
            case 1:
                throw new HttpInformationalCodeException($body, $httpCode);
            case 3:
                throw new HttpRedirectionCodeException($body, $httpCode);
            case 4:
                throw new HttpClientErrorCodeException($body, $httpCode);
            case 5:
                throw new HttpServerErrorCodeException($body, $httpCode);
            default:
            case 2:
                return $body;
        }
    }
public function makeHttpRequest ( ) { $ url = $ this -> addUrlData ( $ this -> Request -> getUrl ( ) , $ this -> Request -> getUrlData ( ) ) ; $ url = $ this -> addGetData ( $ url , $ this -> Request -> getGetData ( ) ) ; $ Resource = curl_init ( $ url ) ; $ options = [ CURLOPT_RETURNTRANSFER => true , CURLOPT_CONNECTTIMEOUT => $ this -> Request -> getConnectTimeout ( ) , CURLOPT_TIMEOUT => $ this -> Request -> getTimeout ( ) , CURLOPT_HEADER => true , ] ; if ( ! $ this -> Request -> isDefaultSslVersion ( ) ) { $ options [ CURLOPT_SSLVERSION ] = $ this -> Request -> getSslVersion ( ) ; } curl_setopt_array ( $ Resource , $ this -> getOptions ( ) + $ options ) ; $ this -> addHeaders ( $ Resource , $ this -> Request -> getHeaders ( ) ) ; $ this -> addPostData ( $ Resource , $ this -> Request -> getPostData ( ) ) ; $ this -> setMethod ( $ Resource , $ this -> Request -> getMethod ( ) ) ; $ result = curl_exec ( $ Resource ) ; if ( $ result === false ) { $ errorCode = curl_errno ( $ Resource ) ; $ errorMessage = curl_error ( $ Resource ) ; curl_close ( $ Resource ) ; throw new CurlErrorException ( $ errorMessage , $ errorCode ) ; } $ headerSize = curl_getinfo ( $ Resource , CURLINFO_HEADER_SIZE ) ; $ headers = substr ( $ result , 0 , $ headerSize ) ; $ this -> parseResponseHeaders ( $ headers ) ; $ body = substr ( $ result , $ headerSize ) ; $ httpCode = curl_getinfo ( $ Resource , CURLINFO_HTTP_CODE ) ; curl_close ( $ Resource ) ; switch ( floor ( $ httpCode / 100 ) ) { case 1 : throw new HttpInformationalCodeException ( $ body , $ httpCode ) ; case 3 : throw new HttpRedirectionCodeException ( $ body , $ httpCode ) ; case 4 : throw new HttpClientErrorCodeException ( $ body , $ httpCode ) ; case 5 : throw new HttpServerErrorCodeException ( $ body , $ httpCode ) ; default : case 2 : return $ body ; } }
Transportation implementation method
@return string request execution result
@throws HttpRedirectionCodeException if http redirect code accepted
@throws HttpClientErrorCodeException if http client error code accepted
@throws HttpInformationalCodeException if http information code accepted
@throws HttpServerErrorCodeException if http server error code accepted
@throws CurlErrorException if libcurl error generated
Transportation implementation method