PHP code example of efabrica / revolt-curl-client
1. Go to this page and download the library: Download efabrica/revolt-curl-client 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/ */
efabrica / revolt-curl-client example snippets
use Efabrica\RevoltCurlClient\RevoltCurlClient;
$client = new RevoltCurlClient();
$f1 = async(function () use ($client) {
echo "Request 1\n";
$response = $client->request('GET', 'https://httpbin.org/get?1');
$response->getContent();
echo "Request 2\n";
$response2 = $client->request('GET', 'https://httpbin.org/get?2');
$response2->getContent();
});
$f2 = async(function () use ($client) {
echo "Request 3\n";
$response = $client->request('GET', 'https://httpbin.org/get?3');
$response->getContent();
echo "Request 4\n";
$response2 = $client->request('GET', 'https://httpbin.org/get?4');
$response2->getContent();
});
await([$f1, $f2]);
// Outputs:
// Request 1
// Request 3
// Request 2
// Request 4