Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 22.x
Latest version:
pecl install openswoole-22.1.2
<?php Swoole\Coroutine\Http2\Client->send(Swoole\Http2\Request $request): int|bool
Returns an integer starting from 1, if the return flow is of an odd increment it means something went wrong with the previous send operation or false
is returned when the request cannot be sent at all. Check $client->errCode
for more details.
Send a request to the server, automatically establishing a HTTP/2 stream for you. Multiple requests can be initiated at the same time.
This method expects a Swoole\Http2\Request
object, you build up this object before you call send()
, this is what the client will use when sending the request to the remote host, based on the settings within the object given.
The Swoole\Http2\Request
object does not have any methods, only public class properties which you can set to build a request you want to send. To learn more about the request object, check its documentation.
Check the main Quick Start Examples to see how the send()
method is used in its full context.