Jump to content

Recommended Posts

Posted

This is how I do asynchronous php processes which doesn't require anything extra to be installed:

$mh = curl_multi_init();

for ($i = 0; $i < $counter; $i++) {
  $ch[$i] = curl_init();
  curl_setopt($ch[$i], CURLOPT_URL, "https://krydos.heliohost.org/script.php?c=".$codes[$i]);
  curl_setopt($ch[$i], CURLOPT_RETURNTRANSFER, true);
  curl_multi_add_handle($mh, $ch[$i]);
}

$running = null;
do {
  curl_multi_exec($mh, $running);
} while ($running);

for ($i = 0; $i < $counter; $i++) {
  curl_multi_remove_handle($mh, $ch[$i]);
}
curl_multi_close($mh);
Guest
This topic is now closed to further replies.
×
×
  • Create New...