WP_Http::processResponse( string $response ): array

In this article

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

Parameters

$responsestringrequired
The full response string.

Return

array Array with response headers and body.
  • headers string
    HTTP response headers.
  • body string
    HTTP response body.

Source

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

Changelog

VersionDescription
2.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.