1

I'm using the following code to execute the CURL Multi, it works fine however output the results to the pate instead I need to get the results into an array so I can process them, does anyone have any idea of how to do this?

$ch1 = curl_init();
$ch2 = curl_init();

$headr = array();
$headr[] = 'Authorization: Bearer xxxyyyzzz';

curl_setopt($ch1, CURLOPT_URL, "https:xxxyyyzzz");
curl_setopt($ch1, CURLOPT_HTTPHEADER, $headr);
curl_setopt($ch2, CURLOPT_URL, "https:xxxyyyzzz1");
curl_setopt($ch2, CURLOPT_HTTPHEADER, $headr);

//create the multiple cURL handle
$mh = curl_multi_init();

//add the two handles
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);

$active = null;
//execute the handles
do { 
    $mrc = curl_multi_exec($mh, $active);
} 
    while ($mrc == CURLM_CALL_MULTI_PERFORM);
    while ($active && $mrc == CURLM_OK) {
    if (curl_multi_select($mh) != -1) {
        do {
            // Run the connections
            $mrc = curl_multi_exec($mh, $active);
        } while ($mrc == CURLM_CALL_MULTI_PERFORM);
    }
}
//close the handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
user1419810
  • 836
  • 1
  • 16
  • 29
  • Possible duplicate of [PHP curl\_multi\_exec output to array](http://stackoverflow.com/questions/24324106/php-curl-multi-exec-output-to-array) – Matt Raines Jun 22 '16 at 10:22

0 Answers0