WP_Http::processResponse()public staticWP 2.7.0

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

Method of the class: WP_Http{}

No Hooks.

Return

Array. Array with response headers and body.

Usage

$result = WP_Http::processResponse( $response );
$response(string) (required)
The full response string.

Changelog

Since 2.7.0 Introduced.

WP_Http::processResponse() code WP 6.5.2

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] : '',
	);
}