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\FastCGI\Client->execute(Swoole\FastCGI\HttpRequest $request, float $timeout = -1): Swoole\FastCGI\HttpResponse
The built up FastCGI Client request object. This object is used to setup the request to send. It must be a Swoole\\FastCGI\\HttpRequest
object.
The default is to never time out (-1
) but you may set a timeout in seconds. So 1.5 means 1.5 seconds.
Returns a Swoole\\FastCGI\\HttpResponse
object. You can catch any errors by using a try-catch with this client.
Execute the request to the FPM server and return the response.
The returned Swoole\FastCGI\HttpResponse
object contains the information from the FPM response.
The most commonly used request object is Swoole\FastCGI\HttpRequest
but you may also use Swoole\FastCGI\Request
which is used for when you are not sending a HTTP request. Refer to the documentation on the request and response objects for more details.
Any errors will thrown an Swoole\Coroutine\FastCGI\Client\Exception
, checkout the Dealing with errors section.
Checkout the main examples to see how this method is used and how to process a response.