1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
public function parseCron() { $nodes = ['', '1', '2']; $node_count = count($nodes); $curl_arr = array(); $master = curl_multi_init(); for($i = 0; $i < $node_count; $i++) { $url ="https:/site.ru/curl.php?city=".$nodes[$i]; $curl_arr[$i] = curl_init($url); curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, true); curl_multi_add_handle($master, $curl_arr[$i]); } do { curl_multi_exec($master,$running); } while($running > 0); } |
curl multi php
Вдохновитель: http://rustyrazorblade.com/2008/02/curl_multi_exec/