PHP 8.5.0 Alpha 4 available for testing

Voting

: min(nine, two)?
(Example: nine)

The Note You're Voting On

kamsamlt888 at gmail dot com
7 years ago
$nodes = array('http://www.google.com', 'http://www.microsoft.com', 'http://yahoo.com');
$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( $i . "\n" . $results . "\n");
}
echo 'done';

<< Back to user notes page

To Top