PHP code example of cognesy / instructor-http-pool
1. Go to this page and download the library: Download cognesy/instructor-http-pool 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/ */
cognesy / instructor-http-pool example snippets
use Cognesy\Http\Collections\HttpRequestList;
use Cognesy\Http\Data\HttpRequest;
use Cognesy\HttpPool\Config\HttpPoolConfig;
use Cognesy\HttpPool\HttpPool;
$pool = HttpPool::fromConfig(new HttpPoolConfig(driver: 'guzzle'));
$responses = $pool->pool(
HttpRequestList::of(
new HttpRequest('https://example.com/a', 'GET', [], '', []),
new HttpRequest('https://example.com/b', 'GET', [], '', []),
),
maxConcurrent: 2,
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.