| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 70 | All time: 10,298 This week: 40 | ||||
| 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
)
)
)
*/
| File | Role | Description | ||
|---|---|---|---|---|
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Lic. | License text | |||
| Doc. | Documentation | |||
| / | src |
| File | Role | Description |
|---|---|---|
| |
Class | Class source |
| |
Class | Class source |
| / | tests |
| File | Role | Description | ||
|---|---|---|---|---|
| |
Data | Auxiliary data | ||
| |
Data | Auxiliary data | ||
| |
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. |
| 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.