Join 4,000+ others and never miss out on new tips, tutorials, and more.
pecl install openswoole-22.0.0 | composer require openswoole/core:22.1.2
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.
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
The response object is built up of the following:
<?php ... $response = $client->recv(...); var_dump($response->statusCode); var_dump($response->headers); var_dump($response->cookies); var_dump($response->set_cookie_headers); var_dump($response->data); ...
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.