Skip to content

Instantly share code, notes, and snippets.

@fadhil-riyanto
Created February 5, 2022 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fadhil-riyanto/f3c26059d760a981ccc352dc504667b2 to your computer and use it in GitHub Desktop.
Save fadhil-riyanto/f3c26059d760a981ccc352dc504667b2 to your computer and use it in GitHub Desktop.
<?php
$host = "https://google.com";
$count = 10000
for ($a = 1; $a < $count; $a++) {
$nodes[] = $host;
}
$node_count = count($nodes);
$curl_arr = array();
$master = curl_multi_init();
for ($i = 0; $i < $node_count; $i++) {
$url = $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);
//echo "results: ";
for ($i = 0; $i < $node_count; $i++) {
$results = curl_multi_getcontent($curl_arr[$i]);
echo "done " . $i;
}
// echo 'done';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment