Recommend this page to a friend! |
Multi curl wrapper for making parallel HTTP requests
composer require smoren/multicurl
composer install
composer test-init
composer test
use Smoren\MultiCurl\MultiCurl;
$mc = new MultiCurl(10, [
CURLOPT_POST => true,
CURLOPT_FOLLOWLOCATION => 1,
], [
'Content-Type' => 'application/json',
]);
$mc->addRequest(1, 'https://httpbin.org/anything', ['some' => 'data']);
$mc->addRequest(2, 'https://httpbin.org/anything', ['some' => 'another data']);
$result = $mc->makeRequests();
print_r($result);
/*
Array
(
[1] => Array
(
[code] => 200
[headers] => Array
(
[Date] => Sat, 14 May 2022 08:21:35 GMT
[Content-Type] => application/json
[Content-Length] => 459
[Connection] => keep-alive
[Server] => gunicorn/19.9.0
[Access-Control-Allow-Origin] => *
[Access-Control-Allow-Credentials] => true
)
[body] => Array
(
[args] => Array
(
)
[data] => {"some":"data"}
[files] => Array
(
)
[form] => Array
(
)
[headers] => Array
(
[Accept] =>
[Accept-Encoding] => deflate, gzip
[Content-Length] => 15
[Content-Type] => application/json
[Host] => httpbin.org
[X-Amzn-Trace-Id] => Root=1-627f668f-2c004f4e5817d2b508e0cd6c
)
[json] => Array
(
[some] => data
)
[method] => POST
[origin] => 46.22.56.202
[url] => https://httpbin.org/anything
)
)
[2] => Array
(
[code] => 200
[headers] => Array
(
[Date] => Sat, 14 May 2022 08:21:36 GMT
[Content-Type] => application/json
[Content-Length] => 475
[Connection] => keep-alive
[Server] => gunicorn/19.9.0
[Access-Control-Allow-Origin] => *
[Access-Control-Allow-Credentials] => true
)
[body] => Array
(
[args] => Array
(
)
[data] => {"some":"another data"}
[files] => Array
(
)
[form] => Array
(
)
[headers] => Array
(
[Accept] =>
[Accept-Encoding] => deflate, gzip
[Content-Length] => 23
[Content-Type] => application/json
[Host] => httpbin.org
[X-Amzn-Trace-Id] => Root=1-627f668f-67767ca73cdb2bf313afa566
)
[json] => Array
(
[some] => another data
)
[method] => POST
[origin] => 46.22.56.202
[url] => https://httpbin.org/anything
)
)
)
*/
Classes of Smoren Freelight | > | PHP Multi Curl Async | > | Download .zip .tar.gz | > | Support forum | > | Blog | > | Latest changes |
|
Groups | Applications | Files |
Groups |
HTTP | HTTP protocol clients, headers and cookies | View top rated classes |
PHP 5 | Classes using PHP 5 specific features | View top rated classes |
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Files |
File | Role | Description | ||
---|---|---|---|---|
.github (1 directory) | ||||
src (2 files) | ||||
tests (3 files, 2 directories) | ||||
codeception.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files | / | src |
File | Role | Description |
---|---|---|
MultiCurl.php | Class | Class source |
MultiCurlRunner.php | Class | Class source |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
unit (1 file) | ||||
_support (1 file) | ||||
coding_standard.xml | Data | Auxiliary data | ||
unit.suite.yml | Data | Auxiliary data | ||
_bootstrap.php | Aux. | Auxiliary script |
Install with Composer - Download all files: multicurl-php.tar.gz multicurl-php.zip NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|
Files |
File | Role | Description | ||
---|---|---|---|---|
.github (1 directory) | ||||
src (2 files) | ||||
tests (3 files, 2 directories) | ||||
codeception.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files | / | src |
File | Role | Description |
---|---|---|
MultiCurl.php | Class | Class source |
MultiCurlRunner.php | Class | Class source |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
unit (1 file) | ||||
_support (1 file) | ||||
coding_standard.xml | Data | Auxiliary data | ||
unit.suite.yml | Data | Auxiliary data | ||
_bootstrap.php | Aux. | Auxiliary script |
Install with Composer - Download all files: multicurl-php.tar.gz multicurl-php.zip NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|