mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-18 14:41:49 +00:00
25 lines
540 B
PHP
25 lines
540 B
PHP
<?php
|
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
|
|
use Curl\MultiCurl;
|
|
|
|
$headers = [
|
|
'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();
|