OpenSwoole Coroutine HTTP/2 Client Response Object

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5


When sending a request using the HTTP/2 Client it will return a OpenSwoole\Http2\Response object after a successful request, you then use this object to access information about the response that was returned from the remote host.

The OpenSwoole\Http2\Response object does not have any methods, only public class properties which you can use to get data from.

This object is returned from recv() and read().

The response object is built up of the following:



$response = $client->recv(...);



Class Properties

  • statusCode: HTTP status code sent by the server, such as 200, 502, etc.

  • headers: Header information sent by the server.

  • cookies: Cookie information set by the server.

  • set_cookie_headers: The original cookie information returned by the server, including the domain and path items.

  • data: The response body sent by the server.


Check the main Quick Start Examples to see how the response object is used in its full context.

Last updated on September 1, 2022