Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 70 This week: 1 | All time: 10,286 This week: 36 |
Version | License | PHP version | Categories | |||
multicurl-php 1.0.0 | MIT/X Consortium ... | 5 | HTTP, PHP 5 |
Description | Author | |
This package can send multiple parallel HTTP requests using Curl. |
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
)
)
)
*/
Files (12) |
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 (12) | / | src |
File | Role | Description |
---|---|---|
MultiCurl.php | Class | Class source |
MultiCurlRunner.php | Class | Class source |
Files (12) | / | 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 |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.