WP_HTTP_Requests_Response::to_array() WordPress Method

The WP_HTTP_Requests_Response::to_array() function is used to convert a WP_HTTP_Requests_Response object to an array.

WP_HTTP_Requests_Response::to_array() #

Converts the object to a WP_Http response array.


Return

(array) WP_Http response array, per WP_Http::request().


Top ↑

Source

File: wp-includes/class-wp-http-requests-response.php

	public function to_array() {
		return array(
			'headers'  => $this->get_headers(),
			'body'     => $this->get_data(),
			'response' => array(
				'code'    => $this->get_status(),
				'message' => get_status_header_desc( $this->get_status() ),
			),
			'cookies'  => $this->get_cookies(),
			'filename' => $this->filename,
		);
	}


Top ↑

Changelog

Changelog
VersionDescription
4.6.0Introduced.

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.