Get the cURL resource

@throws ExpoException

@return null|resource
540747
public function getCurl()
    {
        // Create or reuse existing cURL handle
        $this->ch = $this->ch ?? curl_init();

        // Throw exception if the cURL handle failed
        if (!$this->ch) {
            throw new ExpoException('Could not initialise cURL!');
        }

        return $this->ch;
    }
1009095
function getEndpoint()
    {
        $this->api->curl_header = array(
            'Authorization: OAuth '.$this->api->access_token,
        );
        $data = $this->api->get( $this->metadata_url );

        if ( ! isset( $data->api_endpoint ) ){
            throw new Exception( "Endpoint request failed! {$this->providerId} returned an invalid response.", 6 );
        }

        return $data->api_endpoint;
    }
27529
public function getResource()
    {
        if($this->getFree() <= 0)
        {
            if($this->getCount() < $this->config->getMaxResources())
            {
                // 没有空闲连接，当前连接数少于最大连接数
                $this->addResource();
            }
            else 
            {
                return null;
            }
        }
        $resource = $this->queue->pop();
        if(!$resource || (!$resource->checkState() && !$resource->open()))
        {
            throw new \RuntimeException(sprintf('SyncPool [%s] getResource failed', $this->getName()));
        }
        return $resource;
    }
713974
protected function curl() {
		$ch = curl_init($this->url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

		$response = json_decode(curl_exec($ch));

		curl_close($ch);

		return $response;
	}
1366030
protected function getUploadedResource()
    {
        if ($this->getMappingResultsForProperty()->hasErrors()) {
            return null;
        }
        $resourceObject = $this->getPropertyValue();
        if ($resourceObject instanceof PersistentResource) {
            return $resourceObject;
        }
        return $this->propertyMapper->convert($this->getValueAttribute(), PersistentResource::class);
    }
316871
public function getFeedUrl()
    {
        if ($this->_feedUrl === null) {
            $httpPath = $this->_backendConfig->isSetFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://';
            $this->_feedUrl = $httpPath . self::ELASTICSUITE_FEED_URL;
        }

        return $this->_feedUrl;
    }
834381
public function request() 
	{
		
		if(!$this->getResource()) {
			
			$this->exception("No curl resource was found", debug_backtrace());
		}

		$resource = $this->getResource(); 
		curl_setopt($resource, CURLOPT_URL, $this->getUri());
		//setting curl options
		$headers = $this->getHeaders();

		if(!empty($headers)) {
			
			curl_setopt($resource, CURLOPT_HTTPHEADER, $headers);

			//curl_setopt($resource, CURLOPT_HEADER, true);	
		}

		$method = $this->getMethod();

		$curlMethod = '';
		switch ($method) {
			case CheckoutApi_Client_Adapter_Constant::API_POST:
				$curlMethod =  CheckoutApi_Client_Adapter_Constant::API_POST;
				break;
			case CheckoutApi_Client_Adapter_Constant::API_GET:
				$curlMethod =  CheckoutApi_Client_Adapter_Constant::API_GET;

				break;
			case CheckoutApi_Client_Adapter_Constant::API_DELETE:
			    $curlMethod = CheckoutApi_Client_Adapter_Constant::API_DELETE;
			break;
            case CheckoutApi_Client_Adapter_Constant::API_PUT:
                $curlMethod = CheckoutApi_Client_Adapter_Constant::API_PUT;
            break;
			default :
				
				$this->exception("Method currently not supported", debug_backtrace());
			break;
		}

        if($curlMethod != CheckoutApi_Client_Adapter_Constant::API_GET) {
            curl_setopt($resource, CURLOPT_CUSTOMREQUEST, $curlMethod);
        }

//		curl_setopt($resource , $curlMethod, true);

		if($method == CheckoutApi_Client_Adapter_Constant::API_POST || $method == CheckoutApi_Client_Adapter_Constant::API_PUT  ) {
			curl_setopt($resource, CURLOPT_POSTFIELDS, $this->getPostedParam());
		}

		curl_setopt($resource, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($resource, CURLOPT_SSL_VERIFYPEER, false);


		$response = curl_exec($resource);
		$http_status = curl_getinfo($resource, CURLINFO_HTTP_CODE);

		if($http_status != 200 ) {
			$this->exception("An error has occurred while processing your transaction",
				array(
					'respond_code'=> $http_status,
					'curl_info' => curl_getinfo($resource),
					'respondBody'=>	$response,
					'postedParam' =>$this->getPostedParam(),
					'rawPostedParam' => $this->getRawpostedParam(),
					)
				);

		} elseif (curl_errno($resource)) {

			$info = curl_getinfo($resource);
			$this->exception("Curl issues ",$info);
		} 

 	    $this->setResource($resource);	
	    $this->setRespond($response);
		
		
		return $this;
	}
603135
public function getResource($idx = 0)
    {
        if (null === $this->results || $idx >= \count($this->results)) {
            return null;
        }

        return $this->results[$idx];
    }
233340
public function get()
    {
        $query = $this->getCriteria();

        $args = func_get_args();
        if(empty($args)){
            $args = array("system");
        }

        $isCollection = !$this->isSingleOnly && count($args)==1;

        try {
            $response = $this->client->request($this, 'get', $args, array(), $query);
        } catch(ClientException $ex) {
            throw new Resource\Exception\CommunicationException($ex->getMessage(), $ex);
        }

        return $this->transformResponse($response, $isCollection);
    }
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;
    }
883884
protected function get_resource() {
		$resource = null;
		if (isset($_GET[$this->parent_name]))
			$resource = $this->sql->select($this->request);
		else
			$resource = $this->sql->get_variants($this->config->relation_id['name'], $this->request);
		return $resource;
	}
281808
private function getClient() {
        $token = $this->getParam('token');

        if (empty($token)) {
            throw new ConfigurationException(__CLASS__ . ' is not configured properly. Please set "token" parameter properly.');
        }

        return new \Clickatell\Api\ClickatellRest($token);
    }
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;
    }
994714
public function open()
    {
        if ($this->handle !== null) {
            return $this->handle;
        }

        if (!function_exists('curl_init')) {
            throw new NetworkException('The cURL PHP extension was not loaded.');
        }
        $this->handle = curl_init();

        return $this->handle;
    }
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;
    }
652099
public function read()
    {
        if (!$this->valid()) {
            return null;
        }

        // keep a local copy of the resource; the next() call could change the cached one
        $resource = $this->resource;

        $item = $this->current();
        $this->next();

        // serialize the item
        $event = new ResourceSerializeEvent($resource, $item);
        $this->eventDispatcher->dispatch(FeedEvents::RESOURCE_PRE_SERIALIZE, $event);
        $item = $this->serialize($item);
        $this->eventDispatcher->dispatch(FeedEvents::RESOURCE_POST_SERIALIZE, $event);

        return $item;
    }
1289571
protected function getResource()
    {
        if (empty($this->_resourceName) && empty($this->_resource)) {
            throw new LocalizedException(
                new Phrase('The resource isn\'t set.')
            );
        }

        return $this->_resource ?: ObjectManager::getInstance()->get($this->_resourceName);
    }