@ 2016-06-08T16:05:24Z <?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>";
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.20 , 7.2.0 - 7.2.33 , 7.3.16 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.30 , 8.2.0 - 8.2.24 , 8.3.0 - 8.3.12 Fatal error: Uncaught Error: Call to undefined function curl_multi_init() in /in/spkev:5
Stack trace:
#0 {main}
thrown in /in/spkev on line 5
Process exited with code 255 . Output for 5.5.0 - 5.5.36 , 5.6.0 - 5.6.28 Fatal error: Call to undefined function curl_multi_init() in /in/spkev on line 5
Process exited with code 255 . preferences:dark mode live preview
65.34 ms | 407 KiB | 5 Q