public function testDownloadCallbackError()
 {
     $this->markTestSkipped('Callbacks not permitted at this time.  SugarCRM disallows the use of call_user_func[_array]');
     $this->markTestSkipped('Downloading is disabled as it used file handlers.  SugarCRM disallows fopen and fclose.');
     $download_before_send_called = false;
     $download_callback_called = false;
     $multi_curl = new MultiCurl();
     $multi_curl->beforeSend(function ($instance) use(&$download_before_send_called) {
         PHPUnit_Framework_Assert::assertFalse($download_before_send_called);
         $download_before_send_called = true;
     });
     $multi_curl->addDownload(Test::ERROR_URL, function ($instance, $fh) use(&$download_callback_called) {
         $download_callback_called = true;
     });
     $multi_curl->start();
     $this->assertTrue($download_before_send_called);
     $this->assertFalse($download_callback_called);
 }
 public function testDownloadCallbackError()
 {
     $download_before_send_called = false;
     $download_callback_called = false;
     $multi_curl = new MultiCurl();
     $multi_curl->beforeSend(function ($instance) use(&$download_before_send_called) {
         PHPUnit_Framework_Assert::assertFalse($download_before_send_called);
         $download_before_send_called = true;
     });
     $multi_curl->addDownload(Test::ERROR_URL, function ($instance, $fh) use(&$download_callback_called) {
         $download_callback_called = true;
     });
     $multi_curl->start();
     $this->assertTrue($download_before_send_called);
     $this->assertFalse($download_callback_called);
 }
<?php

require __DIR__ . '/vendor/autoload.php';
use Curl\MultiCurl;
$headers = array('Content-Type' => 'application/json', 'X-CUSTOM-HEADER' => 'my-custom-header');
$multi_curl = new MultiCurl();
$multi_curl->beforeSend(function ($instance) use($headers) {
    foreach ($headers as $key => $value) {
        $instance->setHeader($key, $value);
    }
});
$multi_curl->addGet('https://www.example.com/');
$multi_curl->addGet('https://www.example.org/');
$multi_curl->addGet('https://www.example.net/');
$multi_curl->start();