ext-swooleis supported until v4.7.1, use
ext-openswoole>= v4.7.1. Latest version:
pecl install openswoole-4.9.1
When sending a request using the HTTP/2 Client it will return a
Swoole\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.
Swoole\Http2\Response object does not have any methods, only public class properties which you can use to get data 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.