Requests_Transport_cURL::process_response() WordPress Method

The process_response() method in the Requests_Transport_cURL class is responsible for processing the raw HTTP response from cURL and returning a Requests_Response object. This method is called by the request() method.

Requests_Transport_cURL::process_response( string $response, array $options ) #

Process a response


Parameters

$response

(string)(Required)Response data from the body

$options

(array)(Required)Request options


Top ↑

Return

(string|false) HTTP response data including headers. False if non-blocking.


Top ↑

Source

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

	public function process_response($response, $options) {
		if ($options['blocking'] === false) {
			$fake_headers = '';
			$options['hooks']->dispatch('curl.after_request', array(&$fake_headers));
			return false;
		}
		if ($options['filename'] !== false && $this->stream_handle) {
			fclose($this->stream_handle);
			$this->headers = trim($this->headers);
		}
		else {
			$this->headers .= $response;
		}

		if (curl_errno($this->handle)) {
			$error = sprintf(
				'cURL error %s: %s',
				curl_errno($this->handle),
				curl_error($this->handle)
			);
			throw new Requests_Exception($error, 'curlerror', $this->handle);
		}
		$this->info = curl_getinfo($this->handle);

		$options['hooks']->dispatch('curl.after_request', array(&$this->headers, &$this->info));
		return $this->headers;
	}

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.