Title: WP_Http::processResponse
Published: April 25, 2014
Last modified: August 20, 2026

---

# WP_Http::processResponse( string $response ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#changelog)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#parameters)󠁿

 `$response`stringrequired

The full response string.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#return)󠁿

 array Array with response headers and body.

 * `headers` string
 * HTTP response headers.
 * `body` string
 * HTTP response body.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#source)󠁿

    ```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'    => $response[1] ?? '',
    	);
    }
    ```

[View all references](https://developer.wordpress.org/reference/file/wp-includes/class-wp-http.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-http.php#L691)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-http.php#L691-L698)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Http_Streams::request()](https://developer.wordpress.org/reference/classes/wp_http_streams/request/)`wp-includes/class-wp-http-streams.php` |

Send a HTTP request to a URI using PHP Streams.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_http/processresponse/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fsummer-heart-0930.chufeiyun1688.workers.dev%3A443%2Fhttps%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_http%2Fprocessresponse%2F)
before being able to contribute a note or feedback.