Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 2451

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get information about the current transfers</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.curl-multi-getcontent.html">curl_multi_getcontent</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.curl-multi-init.html">curl_multi_init</a></div>
 <div class="up"><a href="ref.curl.html">cURL Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.curl-multi-info-read" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">curl_multi_info_read</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">curl_multi_info_read</span> &mdash; <span class="dc-title">Get information about the current transfers</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.curl-multi-info-read-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><strong>curl_multi_info_read</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$mh</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$msgs_in_queue</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Ask the multi handle if there are any messages or information from the individual transfers. 
   Messages may include information such as an error code from the transfer or just the fact 
   that a transfer is completed.
  </p>
  <p class="para">   
   Repeated calls to this function will return a new result each time, until a <strong><code>FALSE</code></strong> is returned 
   as a signal that there is no more to get at this point. The integer pointed to with 
   <em><code class="parameter">msgs_in_queue</code></em> will contain the number of remaining messages after this 
   function was called.
  </p>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="para">
    The data the returned resource points to will not survive calling 
     <span class="function"><a href="function.curl-multi-remove-handle.html" class="function">curl_multi_remove_handle()</a></span>.
   </p>
  </div>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.curl-multi-info-read-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>
<span class="term"><em><code class="parameter">mh</code></em>
</span><dd>
<p class="para">A cURL multi handle returned by
 <span class="function"><a href="function.curl-multi-init.html" class="function">curl_multi_init()</a></span>.</p></dd>
</dt>

    <dt>

     <span class="term"><em><code class="parameter">msgs_in_queue</code></em></span>
     <dd>

      <p class="para">
       Number of messages that are still in the queue
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.curl-multi-info-read-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   On success, returns an associative array for the message, <strong><code>FALSE</code></strong> on failure.
  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Contents of the returned array</strong></caption>
    
     <thead>
      <tr>
       <th>Key:</th>
       <th>Value:</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><em>msg</em></td>
       <td>The <strong><code>CURLMSG_DONE</code></strong> constant. Other return values
       are currently not available.</td>
      </tr>

      <tr>
       <td><em>result</em></td>
       <td>One of the <strong><code>CURLE_*</code></strong> constants. If everything is
       OK, the <strong><code>CURLE_OK</code></strong> will be the result.</td>
      </tr>

      <tr>
       <td><em>handle</em></td>
       <td>Resource of type curl indicates the handle which it concerns.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.curl-multi-info-read-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4219">
    <p><strong>Example #1 A  <span class="function"><strong>curl_multi_info_read()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$urls&nbsp;</span><span style="color: #007700">=&nbsp;array(<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"http://www.cnn.com/"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"http://www.bbc.co.uk/"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"http://www.yahoo.com/"<br /></span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$mh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">curl_multi_init</span><span style="color: #007700">();<br /><br />foreach&nbsp;(</span><span style="color: #0000BB">$urls&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$url</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$conn</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">curl_init</span><span style="color: #007700">(</span><span style="color: #0000BB">$url</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">curl_setopt</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">CURLOPT_RETURNTRANSFER</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">curl_multi_add_handle</span><span style="color: #007700">(</span><span style="color: #0000BB">$mh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$conn</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">]);<br />}<br /><br />do&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$status&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">curl_multi_exec</span><span style="color: #007700">(</span><span style="color: #0000BB">$mh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$active</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$info&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">curl_multi_info_read</span><span style="color: #007700">(</span><span style="color: #0000BB">$mh</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">false&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">$info</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$info</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}&nbsp;while&nbsp;(</span><span style="color: #0000BB">$status&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">CURLM_CALL_MULTI_PERFORM&nbsp;</span><span style="color: #007700">||&nbsp;</span><span style="color: #0000BB">$active</span><span style="color: #007700">);<br /><br />foreach&nbsp;(</span><span style="color: #0000BB">$urls&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$url</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$res</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">curl_multi_getcontent</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">]);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">curl_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">]);<br />}<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">curl_multi_info_read</span><span style="color: #007700">(</span><span style="color: #0000BB">$mh</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output
something similar to:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(3) {
  [&quot;msg&quot;]=&gt;
  int(1)
  [&quot;result&quot;]=&gt;
  int(0)
  [&quot;handle&quot;]=&gt;
  resource(5) of type (curl)
}
array(3) {
  [&quot;msg&quot;]=&gt;
  int(1)
  [&quot;result&quot;]=&gt;
  int(0)
  [&quot;handle&quot;]=&gt;
  resource(7) of type (curl)
}
array(3) {
  [&quot;msg&quot;]=&gt;
  int(1)
  [&quot;result&quot;]=&gt;
  int(0)
  [&quot;handle&quot;]=&gt;
  resource(6) of type (curl)
}
bool(false)
</pre></div>
    </div>
   </div>
  </p>
 </div>

 
 <div class="refsect1 changelog" id="refsect1-function.curl-multi-info-read-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.2.0</td>
       <td>
        <em><code class="parameter">msgs_in_queue</code></em> was added.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.curl-multi-info-read-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.curl-multi-init.html" class="function" rel="rdfs-seeAlso">curl_multi_init()</a> - Returns a new cURL multi handle</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.curl-multi-getcontent.html">curl_multi_getcontent</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.curl-multi-init.html">curl_multi_init</a></div>
 <div class="up"><a href="ref.curl.html">cURL Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>