çözdüm birinin ihtiyacı olursa diye paylaşayım kodları
function multi_thread_curl($urlArray, $optionArray, $nThreads) {
$curlArray = array_chunk($urlArray, $nThreads, $preserve_keys = true);
$ch = 'ch_';
foreach($curlArray as $threads) {
foreach($threads as $thread=>$value) {
${$ch . $thread} = curl_init();
curl_setopt_array(${$ch . $thread}, $optionArray);
curl_setopt(${$ch . $thread}, CURLOPT_URL, $value);
}
$mh = curl_multi_init();
foreach($threads as $thread=>$value) {
curl_multi_add_handle($mh, ${$ch . $thread});
}
$active = null;
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 {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
foreach($threads as $thread=>$value) {
$results[$thread] = curl_multi_getcontent(${$ch . $thread});
}
curl_multi_close($mh);
}
return $results;
}