public function send(string $method, string $url)
	{
		// Reset our curl options so we're on a fresh slate.
		$curl_options = [];

		if (! empty($this->config['query']) && is_array($this->config['query']))
		{
			// This is likely too naive a solution.
			// Should look into handling when $url already
			// has query vars on it.
			$url .= '?' . http_build_query($this->config['query']);
			unset($this->config['query']);
		}

		$curl_options[CURLOPT_URL]            = $url;
		$curl_options[CURLOPT_RETURNTRANSFER] = true;
		$curl_options[CURLOPT_HEADER]         = true;
		$curl_options[CURLOPT_FRESH_CONNECT]  = true;
		// Disable @file uploads in post data.
		$curl_options[CURLOPT_SAFE_UPLOAD] = true;

		$curl_options = $this->setCURLOptions($curl_options, $this->config);
		$curl_options = $this->applyMethod($method, $curl_options);
		$curl_options = $this->applyRequestHeaders($curl_options);

		// Do we need to delay this request?
		if ($this->delay > 0)
		{
			sleep($this->delay);
		}

		$output = $this->sendRequest($curl_options);

		$continueStr = "HTTP/1.1 100 Continue\x0d\x0a\x0d\x0a";
		if (strpos($output, $continueStr) === 0)
		{
			$output = substr($output, strlen($continueStr));
		}

		// Split out our headers and body
		$break = strpos($output, "\r\n\r\n");

		if ($break !== false)
		{
			// Our headers
			$headers = explode("\n", substr($output, 0, $break));

			$this->setResponseHeaders($headers);

			// Our body
			$body = substr($output, $break + 4);
			$this->response->setBody($body);
		}
		else
		{
			$this->response->setBody($output);
		}

		return $this->response;
	}
public function send(string $method, string $url)
	{
		// Reset our curl options so we're on a fresh slate.
		$curl_options = [];

		if (! empty($this->config['query']) && is_array($this->config['query']))
		{
			// This is likely too naive a solution.
			// Should look into handling when $url already
			// has query vars on it.
			$url .= '?' . http_build_query($this->config['query']);
			unset($this->config['query']);
		}

		$curl_options[CURLOPT_URL]            = $url;
		$curl_options[CURLOPT_RETURNTRANSFER] = true;
		$curl_options[CURLOPT_HEADER]         = true;
		$curl_options[CURLOPT_FRESH_CONNECT]  = true;
		// Disable @file uploads in post data.
		$curl_options[CURLOPT_SAFE_UPLOAD] = true;

		$curl_options = $this->setCURLOptions($curl_options, $this->config);
		$curl_options = $this->applyMethod($method, $curl_options);
		$curl_options = $this->applyRequestHeaders($curl_options);

		// Do we need to delay this request?
		if ($this->delay > 0)
		{
			sleep($this->delay);
		}

		$output = $this->sendRequest($curl_options);

		$continueStr = "HTTP/1.1 100 Continue\x0d\x0a\x0d\x0a";
		if (strpos($output, $continueStr) === 0)
		{
			$output = substr($output, strlen($continueStr));
		}

		// Split out our headers and body
		$break = strpos($output, "\r\n\r\n");

		if ($break !== false)
		{
			// Our headers
			$headers = explode("\n", substr($output, 0, $break));

			$this->setResponseHeaders($headers);

			// Our body
			$body = substr($output, $break + 4);
			$this->response->setBody($body);
		}
		else
		{
			$this->response->setBody($output);
		}

		return $this->response;
	}
public function send ( string $ method , string $ url ) { // Reset our curl options so we're on a fresh slate. $ curl_options = [ ] ; if ( ! empty ( $ this -> config [ 'query' ] ) && is_array ( $ this -> config [ 'query' ] ) ) { // This is likely too naive a solution. // Should look into handling when $url already // has query vars on it. $ url .= '?' . http_build_query ( $ this -> config [ 'query' ] ) ; unset ( $ this -> config [ 'query' ] ) ; } $ curl_options [ CURLOPT_URL ] = $ url ; $ curl_options [ CURLOPT_RETURNTRANSFER ] = true ; $ curl_options [ CURLOPT_HEADER ] = true ; $ curl_options [ CURLOPT_FRESH_CONNECT ] = true ; // Disable @file uploads in post data. $ curl_options [ CURLOPT_SAFE_UPLOAD ] = true ; $ curl_options = $ this -> setCURLOptions ( $ curl_options , $ this -> config ) ; $ curl_options = $ this -> applyMethod ( $ method , $ curl_options ) ; $ curl_options = $ this -> applyRequestHeaders ( $ curl_options ) ; // Do we need to delay this request? if ( $ this -> delay > 0 ) { sleep ( $ this -> delay ) ; } $ output = $ this -> sendRequest ( $ curl_options ) ; $ continueStr = "HTTP/1.1 100 Continue\x0d\x0a\x0d\x0a" ; if ( strpos ( $ output , $ continueStr ) === 0 ) { $ output = substr ( $ output , strlen ( $ continueStr ) ) ; } // Split out our headers and body $ break = strpos ( $ output , "\r\n\r\n" ) ; if ( $ break !== false ) { // Our headers $ headers = explode ( "\n" , substr ( $ output , 0 , $ break ) ) ; $ this -> setResponseHeaders ( $ headers ) ; // Our body $ body = substr ( $ output , $ break + 4 ) ; $ this -> response -> setBody ( $ body ) ; } else { $ this -> response -> setBody ( $ output ) ; } return $ this -> response ; }
Fires the actual cURL request.

@param string $method
@param string $url

@return \CodeIgniter\HTTP\ResponseInterface
Fires the actual cURL request .