WP_Http::processResponse() WordPress Method

The WP_Http::processResponse() method is used to process the response from an HTTP request. This method is used to check the response for errors and to handle redirects.

WP_Http::processResponse( string $response ) #

Parses the responses and splits the parts into headers and body.


Parameters

$response

(string)(Required)The full response string.


Top ↑

Return

(array) Array with response headers and body.

  • 'headers'
    (string) HTTP response headers.
  • 'body'
    (string) HTTP response body.


Top ↑

Source

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

	public static function processResponse( $response ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
		$response = explode( "\r\n\r\n", $response, 2 );

		return array(
			'headers' => $response[0],
			'body'    => isset( $response[1] ) ? $response[1] : '',
		);
	}


Top ↑

Changelog

Changelog
VersionDescription
2.7.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.