selfworks / parallelcurl
A PHP class providing an easy interface for running multiple concurrent CURL requests.
v1.5
2018-11-02 08:07 UTC
Requires
- php: >=5.0
- ext-curl: *
README
A PHP class providing an easy interface for running multiple concurrent CURL requests
<?php
$maxRequests = 2;
$curlOptions = array(
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_SSL_VERIFYHOST => FALSE,
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_VERBOSE => 0,
CURLOPT_TIMEOUT => 15,
CURLOPT_ENCODING => 'gzip, deflate',
);
$parallelCurl = new \SelfWorks\PrallelCURL\ParallelCurlClass($maxRequests, $curlOptions);
$parallelCurl->startRequest("https://google.com",
array(
'request_id'=>1
));
$parallelCurl->startRequest("https://youtube.com", array(
'request_id'=>2
));
$requestedContent = $parallelCurl->finishAllRequests();
?>