HttpKernel/RemoteHttpKernel.php
private function handleRaw(Request $request) {
        $curl = $this->lastCurlRequest = $this->getCurlRequest();
        $curl->setOptionArray(
            array(
                CURLOPT_URL=>$request->getUri(),
                CURLOPT_HTTPHEADER=>$this->buildHeadersArray($request->headers),
                CURLINFO_HEADER_OUT=>true
            )
        );

        $curl->setMethod($request->getMethod());

        if ("POST" === $request->getMethod()) {
            $this->setPostFields($curl, $request);
        }

        if("PUT" === $request->getMethod() && count($request->files->all()) > 0) {
            $file = current($request->files->all());

            $curl->setOptionArray(
                array(
                    CURLOPT_INFILE=>'@'.$file->getRealPath(),
                    CURLOPT_INFILESIZE=>$file->getSize()
                )
            );
        }

        $content = new ContentCollector();
        $headers = new HeaderCollector();

        // These options must not be tampered with to ensure proper functionality
        $curl->setOptionArray(
            array(
                CURLOPT_HEADERFUNCTION=>array($headers, "collect"),
                CURLOPT_WRITEFUNCTION=>array($content, "collect"),
            )
        );

        $curl->execute();

        $response = new Response(
            $content->retrieve(),
            $headers->getCode(),
            $headers->retrieve()
        );

        $response->setProtocolVersion($headers->getVersion());
        $response->setStatusCode($headers->getCode(), $headers->getMessage());

        return $response;
    }
private function handleRaw(Request $request) {
        $curl = $this->lastCurlRequest = $this->getCurlRequest();
        $curl->setOptionArray(
            array(
                CURLOPT_URL=>$request->getUri(),
                CURLOPT_HTTPHEADER=>$this->buildHeadersArray($request->headers),
                CURLINFO_HEADER_OUT=>true
            )
        );

        $curl->setMethod($request->getMethod());

        if ("POST" === $request->getMethod()) {
            $this->setPostFields($curl, $request);
        }

        if("PUT" === $request->getMethod() && count($request->files->all()) > 0) {
            $file = current($request->files->all());

            $curl->setOptionArray(
                array(
                    CURLOPT_INFILE=>'@'.$file->getRealPath(),
                    CURLOPT_INFILESIZE=>$file->getSize()
                )
            );
        }

        $content = new ContentCollector();
        $headers = new HeaderCollector();

        // These options must not be tampered with to ensure proper functionality
        $curl->setOptionArray(
            array(
                CURLOPT_HEADERFUNCTION=>array($headers, "collect"),
                CURLOPT_WRITEFUNCTION=>array($content, "collect"),
            )
        );

        $curl->execute();

        $response = new Response(
            $content->retrieve(),
            $headers->getCode(),
            $headers->retrieve()
        );

        $response->setProtocolVersion($headers->getVersion());
        $response->setStatusCode($headers->getCode(), $headers->getMessage());

        return $response;
    }
private function handleRaw ( Request $ request ) { $ curl = $ this -> lastCurlRequest = $ this -> getCurlRequest ( ) ; $ curl -> setOptionArray ( array ( CURLOPT_URL => $ request -> getUri ( ) , CURLOPT_HTTPHEADER => $ this -> buildHeadersArray ( $ request -> headers ) , CURLINFO_HEADER_OUT => true ) ) ; $ curl -> setMethod ( $ request -> getMethod ( ) ) ; if ( "POST" === $ request -> getMethod ( ) ) { $ this -> setPostFields ( $ curl , $ request ) ; } if ( "PUT" === $ request -> getMethod ( ) && count ( $ request -> files -> all ( ) ) > 0 ) { $ file = current ( $ request -> files -> all ( ) ) ; $ curl -> setOptionArray ( array ( CURLOPT_INFILE => '@' . $ file -> getRealPath ( ) , CURLOPT_INFILESIZE => $ file -> getSize ( ) ) ) ; } $ content = new ContentCollector ( ) ; $ headers = new HeaderCollector ( ) ; // These options must not be tampered with to ensure proper functionality $ curl -> setOptionArray ( array ( CURLOPT_HEADERFUNCTION => array ( $ headers , "collect" ) , CURLOPT_WRITEFUNCTION => array ( $ content , "collect" ) , ) ) ; $ curl -> execute ( ) ; $ response = new Response ( $ content -> retrieve ( ) , $ headers -> getCode ( ) , $ headers -> retrieve ( ) ) ; $ response -> setProtocolVersion ( $ headers -> getVersion ( ) ) ; $ response -> setStatusCode ( $ headers -> getCode ( ) , $ headers -> getMessage ( ) ) ; return $ response ; }
Execute a Request object via cURL

@param Request $request the request to execute
@param array $options additional curl options to set/override

@return Response

@throws CurlErrorException
Execute a Request object via cURL