do {
$status = curl_multi_exec($mh, $active);
}
while ($active && $status == CURLM_OK);
// echo the content, remove the handlers, then close them
foreach ($channels as $chan) {
echo curl_multi_getcontent($chan);
curl_multi_remove_handle($mh, $chan);
curl_close($chan);
}