PHP code example of bentools / guzzle-queued
1. Go to this page and download the library: Download bentools/guzzle-queued library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bentools / guzzle-queued example snippets
use BenTools\GuzzleQueued\Client as QueuedClient;
use GuzzleHttp\Psr7\Request as PSR7Request;
use Pheanstalk\Pheanstalk;
e, $pheanstalk);
$request = new PSR7Request('GET', 'http://httpbin.org/user-agent');
$promise = $client->sendAsync($request)->then(function (\Psr\Http\Message\ResponseInterface $response) {
echo (string) $response->getBody();
});
$promise->wait(); // Now the hard work has to be done by a separate PHP process
php vendor/bin/guzzle-request-worker.php &