note 119506 added to function.curl-multi-exec

From: Date: Fri, 24 Jun 2016 05:08:52 +0000
Subject: note 119506 added to function.curl-multi-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-205803@lists.php.net to get a copy of this message
// Todas url gravadas em array $url[] = 'http://www.link1.com.br'; $url[] = 'https://www.link2.com.br'; $url[] = 'https://www.link3.com.br'; // Setando opção padrão para todas url e adicionando a fila para processamento $mh = curl_multi_init(); foreach($url as $key => $value){ $ch[$key] = curl_init($value); curl_setopt($ch[$key], CURLOPT_NOBODY, true); curl_setopt($ch[$key], CURLOPT_HEADER, true); curl_setopt($ch[$key], CURLOPT_RETURNTRANSFER, true); curl_setopt($ch[$key], CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch[$key], CURLOPT_SSL_VERIFYHOST, false); curl_multi_add_handle($mh,$ch[$key]); } // Executando consulta do { curl_multi_exec($mh, $running); curl_multi_select($mh); } while ($running > 0); // Obtendo dados de todas as consultas e retirando da fila foreach(array_keys($ch) as $key){ echo curl_getinfo($ch[$key], CURLINFO_HTTP_CODE); echo curl_getinfo($ch[$key], CURLINFO_EFFECTIVE_URL); echo "\n"; curl_multi_remove_handle($mh, $ch[$key]); } // Finalizando curl_multi_close($mh); ---- Server IP: 72.52.91.14 Probable Submitter: 138.118.75.1 ---- Manual Page -- http://php.net/manual/en/function.curl-multi-exec.php Edit -- https://master.php.net/note/edit/119506 Del: integrated -- https://master.php.net/note/delete/119506/integrated Del: useless -- https://master.php.net/note/delete/119506/useless Del: bad code -- https://master.php.net/note/delete/119506/bad+code Del: spam -- https://master.php.net/note/delete/119506/spam Del: non-english -- https://master.php.net/note/delete/119506/non-english Del: in docs -- https://master.php.net/note/delete/119506/in+docs Del: other reasons-- https://master.php.net/note/delete/119506 Reject -- https://master.php.net/note/reject/119506 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205803) next »