Requests_Transport_cURL::get_subrequest_handle() WordPress Method

The Requests_Transport_cURL::get_subrequest_handle() method is used to get a cURL handle for a subrequest. This can be useful for making multiple concurrent requests, or for making requests to an external site while still being able to take advantage of cURL's many features.

Requests_Transport_cURL::get_subrequest_handle( string $url, array $headers, string|array $data, array $options ) #

Get the cURL handle for use in a multi-request


Parameters

$url

(string)(Required)URL to request

$headers

(array)(Required)Associative array of request headers

$data

(string|array)(Required)Data to send either as the POST body, or as parameters in the URL for a GET/HEAD

$options

(array)(Required)Request options, see Requests::response() for documentation


Top ↑

Return

(resource) Subrequest's cURL handle


Top ↑

Source

File: wp-includes/Requests/Transport/cURL.php

	public function &get_subrequest_handle($url, $headers, $data, $options) {
		$this->setup_handle($url, $headers, $data, $options);

		if ($options['filename'] !== false) {
			$this->stream_handle = fopen($options['filename'], 'wb');
		}

		$this->response_data       = '';
		$this->response_bytes      = 0;
		$this->response_byte_limit = false;
		if ($options['max_bytes'] !== false) {
			$this->response_byte_limit = $options['max_bytes'];
		}
		$this->hooks = $options['hooks'];

		return $this->handle;
	}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.