WP_Http::processResponse( string $strResponse )

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

Parameters

$strResponse

(string) (Required) The full response string.

Return

(array) Array with response headers and body.

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

Source

File: wp-includes/class-http.php

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

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

Changelog

Version Description
2.7.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_http/processresponse