Create the cURL resource that represents this request.

@return resource Returns the cURL resource.
@see curl_init(), curl_setopt(), curl_exec()
763798
protected function createCurl() {
        $ch = curl_init();

        // Add the body first so we can calculate a content length.
        $body = '';
        if ($this->method === self::METHOD_HEAD) {
            curl_setopt($ch, CURLOPT_NOBODY, true);
        } elseif ($this->method !== self::METHOD_GET) {
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->method);

            $body = $this->makeCurlBody();
            if ($body) {
                curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
            }
        }

        // Decode the headers.
        $headers = [];
        foreach ($this->getHeaders() as $key => $values) {
            foreach ($values as $line) {
                $headers[] = "$key: $line";
            }
        }

        if (is_string($body) && !$this->hasHeader('Content-Length')) {
            $headers[] = 'Content-Length: '.strlen($body);
        }

        if (!$this->hasHeader('Expect')) {
            $headers[] = 'Expect:';
        }

        curl_setopt(
            $ch,
            CURLOPT_HTTP_VERSION,
            $this->getProtocolVersion() == '1.0' ? CURL_HTTP_VERSION_1_0 : CURL_HTTP_VERSION_1_1
        );

        curl_setopt($ch, CURLOPT_URL, $this->url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_TIMEOUT, $this->getTimeout());
        curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verifyPeer);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $this->verifyPeer ? 2 : 0);
        curl_setopt($ch, CURLOPT_ENCODING, ''); //"utf-8");
        curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);

        if (!empty($this->auth)) {
            curl_setopt($ch, CURLOPT_USERPWD, $this->auth[0].":".((empty($this->auth[1])) ? "" : $this->auth[1]));
        }

        return $ch;
    }
64982
public function create()
  {
    $uses = [
      'Phrest\API\DI\PhrestDIInterface',
      'Phrest\SDK\PhrestSDK',
      'Phrest\SDK\Request\AbstractRequest',
      $this->namespace . '\\' . Generator::$name . 'API'
    ];

    foreach($this->requests as $request)
    {
      $uses[] = $request->getNamespace() . '\\' . $request->getName();
    }

    $class = ClassGen::classGen(
      $this->name,
      $this->namespace . '\\' . $this->version,
      $uses,
      'PhrestSDK'
    );

    $di = new ParameterGenerator('di', 'PhrestDIInterface');
    $constructor = ClassGen::constructor([$di]);
    $constructor->setBody($this->getConstructorBody());
    $class->addMethodFromGenerator($constructor);

    $abstractRequest = new ParameterGenerator('request', 'AbstractRequest');
    $injectDependencies = ClassGen::method(
      'injectDependencies',
      [$abstractRequest],
      'private',
      'return $request;'
    );
    $docBlock = $injectDependencies->getDocBlock();
    $docBlock->setTag(new GenericTag('return', 'AbstractRequest'));
    $class->addMethodFromGenerator($injectDependencies);

    foreach($this->requests as $request)
    {
      $getRequest = ClassGen::method(
        'get' . ucfirst($request->getName()),
        [],
        'public',
        'return $this->injectDependencies(new ' . $request->getName() . '());'
      );
      $getRequest->getDocBlock()->setTag(new GenericTag('return', $request->getName()));
      $class->addMethodFromGenerator($getRequest);
    }

    return $class;
  }
783666
private function execute()
    {
        $data = curl_exec($this->ch);

        if ($data === false) {
            $this->close();

            throw new \Exception('Impossible to pass the result.');
        }

        $this->error = curl_error($this->ch);

        $this->errno = curl_errno($this->ch);

        $this->header = curl_getinfo($this->ch);

        $this->executed = true;

        $this->close();

        return $data;
    }
599328
private function getCurlResource($forceNew = false) {

        if ((true === $forceNew) || (!$this->curlResourceIsValid())) {
            $this->curlResource = curl_init();
        }

        return $this->curlResource;

    }
1132292
private function executeCurl ()
    {
        $result = curl_exec($this->cURL);

        if (!$result)
        {
            throw new CurlException($this->cURL);
        }

        return $result;
    }
1033963
public function create()
    {
        // @codeCoverageIgnoreStart
        if (!empty($this->ch)) {
            curl_close($this->ch);
        }
        // @codeCoverageIgnoreEnd

        // Instantiate cURL object
        $this->ch = curl_init();

        // Apply authentication headers
        $this->authenticate();
    }
711279
protected function execute()
    {
        if ($this->url === null) {
            throw new CurlException('You have to provide an URL for the CurlRequest');
        }

        $ch = curl_init($this->url);
        curl_setopt_array($ch, $this->options);

        $this->content = curl_exec($ch);
        $this->infos   = curl_getinfo($ch);
        $this->error   = curl_error($ch);

        curl_close($ch);

        return $this->content;
    }
789434
public function create()
	{
		try
		{
			$this->client->send(new Request($this->uri->withPath($this->uri->getPath().'resources')
				->withQuery(http_build_query([
					'path' => $this->getPath()
				], null, '&')), 'PUT'));
			$this->setContents([]);
		}
		catch (\Exception $exc)
		{
			throw $exc;
		}

		return $this;
	}
741484
private function _setupCurl()
    {
        $requestParams = http_build_query($this->requestParams);

        $this->uri = $this->action;
        if ($this->method == 'GET') {
            $this->uri .= '?'.$requestParams;
        }

        $this->curl = curl_init($this->uri);

        if ($this->method == 'POST') {
            // POST requests
            curl_setopt($this->curl, CURLOPT_POST, true);
            curl_setopt($this->curl, CURLOPT_POSTFIELDS, $requestParams);
        }

        // We want to receive the returned data
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true);
        // Setup custom user agent
        curl_setopt($this->curl, CURLOPT_HTTPHEADER, $this->formatUserAgentInfo());
    }
276901
public function createRequest() {
        $request = new \Amp\Artax\Request();
        $url = null;
        $request->setMethod('GET');

        $queryParameters = [];

        if (array_key_exists('Accept', $this->parameters) == true) {
        $value = $this->getFilteredParameter('Accept');
            $request->setHeader('Accept', $value);
        }
        $value = $this->getFilteredParameter('Authorization');
        if ($value != null) {
            $request->setHeader('Authorization', $value);
        }
        $value = $this->getFilteredParameter('userAgent');
        $request->setHeader('User-Agent', $value);
        if (array_key_exists('perPage', $this->parameters) == true) {
        $value = $this->getFilteredParameter('perPage');
            $queryParameters['per_page'] = $value;
        }
        if (array_key_exists('otp', $this->parameters) == true) {
        $value = $this->getFilteredParameter('otp');
            $request->setHeader('X-GitHub-OTP', $value);
        }
        $value = $this->getFilteredParameter('pageURL');
        $url = $value;

        //Parameters are parsed and set, lets prepare the request
        if ($url == null) {
            $url = "https://api.github.com";
        }
        if (count($queryParameters)) {
            $url = $url.'?'.http_build_query($queryParameters, '', '&', PHP_QUERY_RFC3986);
        }
        $request->setUri($url);

        return $request;
    }
294868
public function createUrl()
    {
        $curlUrl = $this->url . '?';

        foreach ($this->params as $key => $value) {
            $curlUrl .= $key . '=' . $value;
            $curlUrl .= '&';
        }

        return $curlUrl;
    }
973569
public function connect() 
	{
		if($this->getResource()) {
			$this->close();
		}

		$resource = curl_init();

		curl_setopt($resource,CURLOPT_CONNECTTIMEOUT,$this->getTimeout());
	
		$this->setResource($resource);
		parent::connect();
		return $this;
	}
260216
protected function createHandle()
    {
        $curl = $this->handles ? \array_pop($this->handles) : \curl_init();
        if (false === $curl) {
            throw new ClientException('Unable to create a new cURL handle');
        }

        return $curl;
    }
310801
private function _createCurlHandle() {

        // Make sure the cURL extension is enabled
        if (!$this->isSupported()) {
            $this->logger->error("cURL extension not found (or not enabled).");
            throw new UnsupportedException('cURL extension not found (or not enabled).');
        }
        $this->logger->info("cURL extension is loaded.");

        // Initialize cURL
        $curl = curl_init();
        // If cURL is still not initialized, then there is a problem
        if (!$curl) {
            $this->logger->error("cURL was unable to initalized successfully.");
            throw new RuntimeException('Unable to create handle for cURL.');
        }
        $this->logger->info("cURL initialised successfully.");

        // Set default cURL configuration
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($curl, CURLOPT_TIMEOUT, 10);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($curl, CURLOPT_MAXREDIRS, 3);

        // Ensure we correctly perform peer verification for PHP < 5.6 by using
        // our own CA certificate store (see https://wiki.php.net/rfc/tls-peer-verification)
        // otherwise just fall back to the sane system options for PHP >= 5.6
        if (version_compare(PHP_VERSION, '5.6.0', '<')) {
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($curl, CURLOPT_CAINFO, __DIR__ . '/../../cacert.pem');
            $this->logger->info("Manually specifying CA certificate store.");
        }
        curl_setopt($curl, CURLOPT_USERAGENT, 'xsist10-PHP-client');

        return $curl;
    }
436991
public function create()
    {
        $params = array(
            'slug' => $this->ensureParameter('slug'),
            'name' => $this->ensureParameter('name'),
            'i18n_type' => $this->ensureParameter('i18nType'),
            'content' => $this->ensureParameter('content'),
        );

        $this->post(
            sprintf('project/%s/resources/', $this->ensureParameter('project')),
            $params
        );

        return $this;
    }
494498
public function getCurl()
    {
        if (is_null($this->curl)) {
            $curl = oxNew(\OxidEsales\PayPalModule\Core\Curl::class);
            $this->setCurl($curl);
        }

        return $this->curl;
    }
1135035
public function execute() {
        $value = curl_exec($this->handle);

        $error_no = curl_errno($this->handle);

        if (0 !== $error_no) {
            throw new CurlErrorException(curl_error($this->handle), $error_no);
        }

        return $value;
    }