PHP code example of selfworks / parallelcurl

1. Go to this page and download the library: Download selfworks/parallelcurl 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/ */

    

selfworks / parallelcurl example snippets



$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();