3v4l.org

run code in 300+ PHP versions simultaneously
<?php $urls = array('www.roi.ru/api/petition/309.json', 'www.roi.ru/api/petition/401.json'); $urls2 = array('api.vkontakte.ru/method/users.get?uids=1', 'api.vkontakte.ru/method/users.get?uids=2'); $cmh = curl_multi_init(); $tasks = array(); foreach ($urls2 as $url) { $ch = curl_init('https://'.$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $tasks[$url] = $ch; curl_multi_add_handle($cmh, $ch); } $active = null; do { $mrc = curl_multi_exec($cmh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); while ($active && ($mrc == CURLM_OK)) { if (curl_multi_select($cmh) != -1) { do { $mrc = curl_multi_exec($cmh, $active); $info = curl_multi_info_read($cmh); if ($info['msg'] == CURLMSG_DONE) { $ch = $info['handle']; $url = array_search($ch, $tasks); $tasks[$url] = curl_multi_getcontent($ch); curl_multi_remove_handle($cmh, $ch); curl_close($ch); } } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } curl_multi_close($cmh); echo "<br><pre>"; var_dump($tasks); echo "</pre>"; ?>

preferences:
50 ms | 402 KiB | 5 Q