Returns a curl object for conntecting to solr.

@return \curl
960983
public function get_curl_object() {
        if (!is_null($this->curl)) {
            return $this->curl;
        }

        // Connection to Solr is allowed to use 'localhost' and other potentially blocked hosts/ports.
        $this->curl = new \curl(['ignoresecurity' => true]);

        $options = array();
        // Build the SSL options. Based on pecl-solr and general testing.
        if (!empty($this->config->secure)) {
            if (!empty($this->config->ssl_cert)) {
                $options['CURLOPT_SSLCERT'] = $this->config->ssl_cert;
                $options['CURLOPT_SSLCERTTYPE'] = 'PEM';
            }

            if (!empty($this->config->ssl_key)) {
                $options['CURLOPT_SSLKEY'] = $this->config->ssl_key;
                $options['CURLOPT_SSLKEYTYPE'] = 'PEM';
            }

            if (!empty($this->config->ssl_keypassword)) {
                $options['CURLOPT_KEYPASSWD'] = $this->config->ssl_keypassword;
            }

            if (!empty($this->config->ssl_cainfo)) {
                $options['CURLOPT_CAINFO'] = $this->config->ssl_cainfo;
            }

            if (!empty($this->config->ssl_capath)) {
                $options['CURLOPT_CAPATH'] = $this->config->ssl_capath;
            }
        }

        // Set timeout as for Solr client.
        $options['CURLOPT_TIMEOUT'] = !empty($this->config->server_timeout) ? $this->config->server_timeout : '30';

        $this->curl->setopt($options);

        if (!empty($this->config->server_username) && !empty($this->config->server_password)) {
            $authorization = $this->config->server_username . ':' . $this->config->server_password;
            $this->curl->setHeader('Authorization: Basic ' . base64_encode($authorization));
        }

        return $this->curl;
    }
512509
protected function getHandle()
	{
		if (!isset(self::$handle))
		{
			self::$handle = $this->getNewHandle();
		}

		curl_setopt(self::$handle, CURLOPT_SSL_VERIFYPEER, $this->sslVerifyPeer);
		curl_setopt(self::$handle, CURLOPT_TIMEOUT,        $this->timeout);

		return self::$handle;
	}
611508
public function getHttpTransport()
	{
		// lazy load a default if one has not be set
		if ($this->_httpTransport === false)
		{
			require_once(dirname(__FILE__) . '/HttpTransport/FileGetContents.php');

			$this->_httpTransport = new Apache_Solr_HttpTransport_FileGetContents();
		}

		return $this->_httpTransport;
	}
1286089
private function getUrlFileSerializer()
    {
        if ($this->urlFileSerializer === null) {
            $this->urlFileSerializer = new UrlFileSerializer();
            $this->urlFileSerializer->setServiceLocator($this->getServiceLocator());
        }

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

        return $this->curl;
    }
560846
public function send() {
        $curlUrl = $this->url;
        if ($this->params) {
            $queryString = http_build_query($this->params);
            $separator = parse_url($curlUrl, PHP_URL_QUERY) ? '&' : '?';
            $curlUrl .= $separator . $queryString;
        }

        // Mock the request if self::$mock exists
        if (self::$mock) {
            if (self::$mock['url'] == $curlUrl && self::$mock['method'] == $this->method) {
                return self::$mock['response'];
            }
            return null;
        }

        // Open and configure curl connection
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $curlUrl);
        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
        $headers = array(
            'User-Agent: SiftScience/v' . $this->version . ' sift-php/' . Sift::VERSION
        );
        if ($this->auth) {
            curl_setopt($ch, CURLOPT_USERPWD, $this->auth);
        }

        // HTTP-method-specific configuration.
        if ($this->method == self::POST) {
            if (function_exists('json_encode')) {
                $jsonString = json_encode($this->body);
            } else {
                require_once(dirname(__FILE__) . '/Services_JSON-1.0.3/JSON.php');
                $json = new Services_JSON();
                $jsonString = $json->encodeUnsafe($this->body);
            }

            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonString);
            array_push($headers, 'Content-Type: application/json',
                'Content-Length: ' . strlen($jsonString)
            );

        } else if ($this->method == self::DELETE) {
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
        }

        foreach ($this->curl_opts as $option => $value) {
            if ($option !== CURLOPT_HTTPHEADER) {
                curl_setopt($ch, $option, $value);
            } else {
                $headers = array_merge($headers, $value);
            }
        }

        // Send the request using curl and parse result
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        $result = curl_exec($ch);
        $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        $curlErrno = curl_errno($ch);
        $curlError = curl_error($ch);
        curl_close($ch);

        return new SiftResponse($result, $httpStatusCode, $this, $curlErrno, $curlError);
    }
1231327
public function getQuery() : string {
        switch ($this->authType) {
            case self::CREDENTIAL:
                return sprintf('credentialToken=%s', $this->getCredentialToken());
            case self::HANDLER:
                return sprintf('handlerToken=%s', $this->getHandlerToken());
            case self::IDENTITY:
                return sprintf('identityToken=%s', $this->getIdentityToken());
        }
    }
753541
protected function getDataFromCurl()
    {
        $data = curl_exec($this->curl);
        if (curl_errno($this->curl)) {
            $this->addError(curl_getinfo($this->curl, CURLINFO_EFFECTIVE_URL), curl_error($this->curl));

            return false;
        }

        return $data;
    }
607147
public function exec()
    {
        $this->build();

        $data = curl_exec($this->ch);

        if(curl_errno($this->ch))
        {
            throw new CurlError(curl_error($this->ch));
        }

        curl_close($this->ch);

        return $data;
    }
765625
public function send()
    {
        $curl = curl_init();

        $this->addParameters()->addHeaders();
        curl_setopt_array($curl, $this->options);
        curl_exec($curl);

        $this->meta = array(
            'info'             => curl_getinfo($curl, CURLINFO_HTTP_CODE),
            'error_message'    => curl_errno($curl),
            'error_code'    => curl_error($curl));

        curl_close($curl);
        unset($curl);

        return $this;
    }
342224
private function curlit() {
    $this->response['raw'] = '';

    // method handling
    switch ($this->method) {
      case 'POST':
        break;
      default:
        // GET, DELETE request so convert the parameters to a querystring
        if ( ! empty($this->request_params)) {
          foreach ($this->request_params as $k => $v) {
            // Multipart params haven't been encoded yet.
            // Not sure why you would do a multipart GET but anyway, here's the support for it
            if ($this->config['multipart']) {
              $params[] = $this->safe_encode($k) . '=' . $this->safe_encode($v);
            } else {
              $params[] = $k . '=' . $v;
            }
          }
          $qs = implode('&', $params);
          $this->url = strlen($qs) > 0 ? $this->url . '?' . $qs : $this->url;
          $this->request_params = array();
        }
        break;
    }

    // configure curl
    $c = curl_init();
    curl_setopt_array($c, array(
      CURLOPT_USERAGENT      => $this->config['user_agent'],
      CURLOPT_CONNECTTIMEOUT => $this->config['curl_connecttimeout'],
      CURLOPT_TIMEOUT        => $this->config['curl_timeout'],
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_SSL_VERIFYPEER => $this->config['curl_ssl_verifypeer'],
      CURLOPT_SSL_VERIFYHOST => $this->config['curl_ssl_verifyhost'],

      CURLOPT_FOLLOWLOCATION => $this->config['curl_followlocation'],
      CURLOPT_PROXY          => $this->config['curl_proxy'],
      CURLOPT_ENCODING       => $this->config['curl_encoding'],
      CURLOPT_URL            => $this->url,
      // process the headers
      CURLOPT_HEADERFUNCTION => array($this, 'curlHeader'),
      CURLOPT_HEADER         => false,
      CURLINFO_HEADER_OUT    => true,
    ));

    if ($this->config['curl_cainfo'] !== false)
      curl_setopt($c, CURLOPT_CAINFO, $this->config['curl_cainfo']);

    if ($this->config['curl_capath'] !== false)
      curl_setopt($c, CURLOPT_CAPATH, $this->config['curl_capath']);

    if ($this->config['curl_proxyuserpwd'] !== false)
      curl_setopt($c, CURLOPT_PROXYUSERPWD, $this->config['curl_proxyuserpwd']);

    if ($this->config['is_streaming']) {
      // process the body
      $this->response['content-length'] = 0;
      curl_setopt($c, CURLOPT_TIMEOUT, 0);
      curl_setopt($c, CURLOPT_WRITEFUNCTION, array($this, 'curlWrite'));
    }

    switch ($this->method) {
      case 'GET':
        break;
      case 'POST':
        curl_setopt($c, CURLOPT_POST, true);
        break;
      default:
        curl_setopt($c, CURLOPT_CUSTOMREQUEST, $this->method);
    }

    if ( ! empty($this->request_params) ) {
      // if not doing multipart we need to implode the parameters
      if ( ! $this->config['multipart'] ) {
        foreach ($this->request_params as $k => $v) {
          $ps[] = "{$k}={$v}";
        }
        $this->request_params = implode('&', $ps);
      }
      curl_setopt($c, CURLOPT_POSTFIELDS, $this->request_params);
    } else {
      // CURL will not set the content-length  (or set it to -1) when there is no data, which breaks Twitter
      // override this and set the length to 0 in that case.
      $this->headers['Content-Type'] = '';
      $this->headers['Content-Length'] = '0';
    }

    // CURL defaults to setting this to Expect: 100-Continue which Twitter rejects
    $this->headers['Expect'] = '';

    if ( ! empty($this->headers)) {
      foreach ($this->headers as $k => $v) {
        $headers[] = trim($k . ': ' . $v);
      }
      curl_setopt($c, CURLOPT_HTTPHEADER, $headers);
    }

    if (isset($this->config['prevent_request']) && true == $this->config['prevent_request'])
      return;

    // do it!
    $response = curl_exec($c);
    $code = curl_getinfo($c, CURLINFO_HTTP_CODE);
    $info = curl_getinfo($c);
    $error = curl_error($c);
    $errno = curl_errno($c);
    curl_close($c);

    // store the response
    $this->response['code'] = $code;
    $this->response['response'] = $response;
    $this->response['info'] = $info;
    $this->response['error'] = $error;
    $this->response['errno'] = $errno;

    if (!isset($this->response['raw'])) {
      $this->response['raw'] = '';
    }
    $this->response['raw'] .= $response;

    return $code;
  }
1110473
public function buildCurlClient()
    {
        //
        // Use PHP Native cURL because the various Soap clients (BeSimple,
        // PHP native SoapClient) can't handle the WSDL file.
        //
        $this->curl = curl_init($this->getEndPoint());

        $sslCertificate = $this->getSslCertificate();
        $sslKey         = $this->getSslKey();
        $sslKeyPassword = $this->getSslKeyPassword();
        $userName       = $this->getUsername();
        $password       = $this->getPassword();
        $headers        = $this->getHeaders();

        // configuring cURL not to verify the server certificate
        curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0);

        // setting the path where cURL can find the client certificate
        curl_setopt($this->curl, CURLOPT_SSLCERT, $sslCertificate);

        // setting the path where cURL can find the client certificate’s
        // private key
        curl_setopt($this->curl, CURLOPT_SSLKEY, $sslKey);

        // setting the key password
        curl_setopt($this->curl, CURLOPT_SSLKEYPASSWD, $sslKeyPassword);

        // setting the request type to POST
        curl_setopt($this->curl, CURLOPT_POST, 1);

        // setting the content type
        curl_setopt($this->curl, CURLOPT_HTTPHEADER, $headers);

        // setting the authorization method to BASIC
        curl_setopt($this->curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);

        // supplying your credentials
        curl_setopt($this->curl, CURLOPT_USERPWD, $userName . ':' . $password);

        // telling cURL to return the HTTP response body as operation result
        // value when calling curl_exec
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);

        return $this->curl;
    }
493095
public function getSolrFields()
    {
        $solr = $this->def->getSolr();
        if (!$solr instanceof Solr) {
            return [];
        }

        $fields = [];
        foreach ($solr->getFields() as $field) {
            $fields[] = [
                'name' => $field->getName(),
                'type' => $field->getType(),
                'weight' => $field->getWeight()
            ];
        }

        return $fields;
    }
280062
public function curl($opts){
        $apiAccessToken = $this->getApiAccessToken();
        $apiEndPoint = $this->getApiEndPoint();
        $headers = array(
            'Authorization' => 'bearer ' . $apiAccessToken 
        );
        $defaultOpts = [
            'url' => '',
            'method' => 'get',
            'timeout' => 1,
            'uri' => $apiEndPoint,
            'path' => '',
            'data' => [],
            'headers' => $headers,
        ];
        $opts = array_merge($defaultOpts, $opts);

        $url = $opts['url'] ? : $opts['uri'] . $opts['path'];
        $curl = new Curl();
        $curl->setHeaders($opts['headers']);
        $curl->setRetry(1);
        $curl->setTimeout($opts['timeout']);
        if($opts['method'] == 'get'){
            $curl->get($url, $opts['data']);
        }else if($opts['method'] == 'post'){
            $curl->post($url, $opts['data']);
        }

        if ($curl->error) {
            return false;
        } else {
            return $curl->response;
        }
    }
670843
private function createCurl()
    {
        $parameters = $this->getParameters();
        $timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0) * 1000;

        if (filter_var($host = $parameters->host, FILTER_VALIDATE_IP)) {
            $host = "[$host]";
        }

        $options = array(
            CURLOPT_FAILONERROR => true,
            CURLOPT_CONNECTTIMEOUT_MS => $timeout,
            CURLOPT_URL => "$parameters->scheme://$host:$parameters->port",
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_POST => true,
            CURLOPT_WRITEFUNCTION => array($this, 'feedReader'),
        );

        if (isset($parameters->user, $parameters->pass)) {
            $options[CURLOPT_USERPWD] = "{$parameters->user}:{$parameters->pass}";
        }

        curl_setopt_array($resource = curl_init(), $options);

        return $resource;
    }
406214
def curl(self):
        
        ret = 'curl -X %s ' % self.method
        ret += self.url
        if self.request_data:
            ret += " -d '%s'" % json.dumps(self.request_data)
        if self.headers:
            ret += ''.join(
                [' -H "%s: %s"' % (k, v) for k, v in self.headers.items()])
        if self.cookies:
            ret += ' --cookie "%s"' % (
                '&'.join(['%s=%s' % (k, v) for k, v in self.cookies.items()]),)
        return ret
435450
public function send()
    {
        $ch = curl_init($this->requestUrl);

        $cOptions = array(
            CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_CUSTOMREQUEST => 'POST',
            CURLOPT_URL => $this->requestUrl,
            CURLOPT_POSTFIELDS => $this->data
        );
        curl_setopt_array($ch, $cOptions);
        $ret = curl_exec($ch);
        curl_close($ch);

        return $this->parseReturnData($ret);
    }