mam sobie taki multicurl
$count = 1;
foreach ($guests as $g) {
$url = 'http://api.ipstack.com/'.$g['customer']['ip'].'?access_key='.$apiAcessKey.'&output=json';
${'ch'.$count} = curl_init($url);
curl_setopt(${'ch'.$count}, CURLOPT_RETURNTRANSFER, true);
$count++;
}
$mh = curl_multi_init();
$count = 1;
foreach ($guests as $g) {
curl_multi_add_handle($mh, ${'ch'.$count});
$count++;
}
$running = null;
do {curl_multi_exec($mh, $running);}
while ($running);
$count = 1;
foreach ($guests as $g) {
curl_multi_remove_handle($mh, ${'ch'.$count});
$count++;
}
curl_multi_close($mh);
$count = 1;
foreach ($guests as $g) {
${'response'.$count} = curl_multi_getcontent(${'ch'.$count});
$jsonData[$count] = json_decode(${'response'.$count}, true);
$count++;
}
ktory w pozniejszej petli wywoluje
$thisCustomer = $jsonData[$number];
wszystko niby ok bo robi curla w tle i nie musze czekac az skonczy, bo mam akurat te petle w tabie na ktory norlamnie przechodze w kazdej chwili, problem polega na tym, ze mniej wiecej po 30-40 czaem 50 petlach - czasami robi dziurky i dalej np 70-90 petla jest ok i dalej null, wywala blad null, czyli podczas wywowalania jest komunikat:
Notice: Trying to access array offset on value of type null in /home/shpaque/domains/todar.pl/private_html/templates/pages/adminCustomers.tpl on line 408
(
Notice: Trying to access array offset on value of type null in /home/shpaque/domains/todar.pl/private_html/templates/pages/adminCustomers.tpl on line 408
)
linia 408 to to:
<p class="text-left align-self-center" style="margin-bottom: 0; color: #fff !important;"><?php echo $thisCustomer['city']; ?> <small>(
<?php echo $thisCustomer['region_name']; ?>)
</small></p>