Note that there are some explanatory texts on larger screens.

plurals
  1. POcurl_errno returns 0 instead of 6
    primarykey
    data
    text
    <pre><code>$data_struct = array(); $data_struct[]['opts'] = array( CURLOPT_URL =&gt; 'http://www.yahoo.com/', CURLOPT_RETURNTRANSFER =&gt; true); $data_struct[]['opts'] = array( CURLOPT_URL =&gt; 'http://www.google.com/', CURLOPT_RETURNTRANSFER =&gt; true); $data_struct[]['opts'] = array( CURLOPT_URL =&gt; 'http://404.php.net/', CURLOPT_RETURNTRANSFER =&gt; true); //create the multiple cURL handle $mh = curl_multi_init(); // create and add handles to data structure foreach ($data_struct as $i =&gt; $data){ $data_struct[$i]['handle'] = curl_init(); curl_setopt_array($data_struct[$i]['handle'], $data_struct[$i]['opts']); curl_multi_add_handle($mh, $data_struct[$i]['handle']); } $active = null; //execute the handles do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); while ($active &amp;&amp; $mrc == CURLM_OK) { if (curl_multi_select($mh) != -1) { do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } foreach ($data_struct as $i =&gt; $data){ $row = array(); $row['httpcode'] = curl_getinfo($data_struct[$i]['handle'] , CURLINFO_HTTP_CODE); $row['url'] = $data['opts'][CURLOPT_URL]; $row['error'] = curl_error($data_struct[$i]['handle']); $row['errorno'] = curl_errno($data_struct[$i]['handle']); print_r($row); echo "\n"; curl_multi_remove_handle($mh, $data_struct[$i]['handle']); curl_close($data_struct[$i]['handle']); } </code></pre> <p>output</p> <pre><code>Array ( [httpcode] =&gt; 302 [url] =&gt; http://www.yahoo.com/ [error] =&gt; [errorno] =&gt; 0 ) Array ( [httpcode] =&gt; 302 [url] =&gt; http://www.google.com/ [error] =&gt; [errorno] =&gt; 0 ) Array ( [httpcode] =&gt; 0 [url] =&gt; http://404.php.net/ [error] =&gt; Couldn't resolve host '404.php.net' [errorno] =&gt; 0 ) </code></pre> <p>In the same situation multi curl returns 0 with curl_errno function despite the fact that curl_error returns error message.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload