$multiCurl
=
array
();
$result
=
array
();
$mh
= curl_multi_init();
foreach
(
$ids
as
$i
=>
$id
) {
$fetchURL
=
'https://domain.com&customerId='
.
$id
;
$multiCurl
[
$i
] = curl_init();
curl_setopt(
$multiCurl
[
$i
], CURLOPT_URL,
$fetchURL
);
curl_setopt(
$multiCurl
[
$i
], CURLOPT_HEADER,0);
curl_setopt(
$multiCurl
[
$i
], CURLOPT_RETURNTRANSFER,1);
curl_multi_add_handle(
$mh
,
$multiCurl
[
$i
]);
}
$index
=null;
do
{
curl_multi_exec(
$mh
,
$index
);
}
while
(
$index
> 0);
foreach
(
$multiCurl
as
$k
=>
$ch
) {
$result
[
$k
] = curl_multi_getcontent(
$ch
);
curl_multi_remove_handle(
$mh
,
$ch
);
}
curl_multi_close(
$mh
);
0 comments:
Post a Comment