src/net/http/CurlHttpClient.php
protected function prepareCurlOptions(HttpRequest $request, CurlHttpResponse $response) {
        $options  = [CURLOPT_URL       => $request->getUrl()] + $this->options;
        $options += [CURLOPT_TIMEOUT   => $this->timeout    ];
        $options += [CURLOPT_USERAGENT => $this->userAgent  ];
        $options += [CURLOPT_ENCODING  => ''                ];  // empty string activates all supported encodings

        if (!isset($options[CURLOPT_WRITEHEADER]))
            $options += [CURLOPT_HEADERFUNCTION => [$response, 'writeHeader']];

        if (!isset($options[CURLOPT_FILE]))                     // overrides CURLOPT_RETURNTRANSFER
            $options += [CURLOPT_WRITEFUNCTION  => [$response, 'writeContent']];

        foreach ($request->getHeaders() as $key => $value) {    // add all specified request headers
            $options[CURLOPT_HTTPHEADER][] = $key.': '.$value;
        }
        return $options;
    }
protected function prepareCurlOptions(HttpRequest $request, CurlHttpResponse $response) {
        $options  = [CURLOPT_URL       => $request->getUrl()] + $this->options;
        $options += [CURLOPT_TIMEOUT   => $this->timeout    ];
        $options += [CURLOPT_USERAGENT => $this->userAgent  ];
        $options += [CURLOPT_ENCODING  => ''                ];  // empty string activates all supported encodings

        if (!isset($options[CURLOPT_WRITEHEADER]))
            $options += [CURLOPT_HEADERFUNCTION => [$response, 'writeHeader']];

        if (!isset($options[CURLOPT_FILE]))                     // overrides CURLOPT_RETURNTRANSFER
            $options += [CURLOPT_WRITEFUNCTION  => [$response, 'writeContent']];

        foreach ($request->getHeaders() as $key => $value) {    // add all specified request headers
            $options[CURLOPT_HTTPHEADER][] = $key.': '.$value;
        }
        return $options;
    }
protected function prepareCurlOptions ( HttpRequest $ request , CurlHttpResponse $ response ) { $ options = [ CURLOPT_URL => $ request -> getUrl ( ) ] + $ this -> options ; $ options += [ CURLOPT_TIMEOUT => $ this -> timeout ] ; $ options += [ CURLOPT_USERAGENT => $ this -> userAgent ] ; $ options += [ CURLOPT_ENCODING => '' ] ; // empty string activates all supported encodings if ( ! isset ( $ options [ CURLOPT_WRITEHEADER ] ) ) $ options += [ CURLOPT_HEADERFUNCTION => [ $ response , 'writeHeader' ] ] ; if ( ! isset ( $ options [ CURLOPT_FILE ] ) ) // overrides CURLOPT_RETURNTRANSFER $ options += [ CURLOPT_WRITEFUNCTION => [ $ response , 'writeContent' ] ] ; foreach ( $ request -> getHeaders ( ) as $ key => $ value ) { // add all specified request headers $ options [ CURLOPT_HTTPHEADER ] [ ] = $ key . ': ' . $ value ; } return $ options ; }
Create a cUrl options array for the current request.

@param  HttpRequest      $request
@param  CurlHttpResponse $response

@return array - resulting options
Create a cUrl options array for the current request .