svn: /phpdoc/en/trunk/reference/curl/functions/ curl-multi-info-read.xml

From: Date: Sun, 11 Apr 2010 10:12:27 +0000
Subject: svn: /phpdoc/en/trunk/reference/curl/functions/ curl-multi-info-read.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-6368@lists.php.net to get a copy of this message
degeberg Sun, 11 Apr 2010 10:12:27 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=297829 Log: Integrated user notes 97253 and 97254 both by pcdinh at phpvietnam dot net into the manual. Changed paths: U phpdoc/en/trunk/reference/curl/functions/curl-multi-info-read.xml Modified: phpdoc/en/trunk/reference/curl/functions/curl-multi-info-read.xml =================================================================== --- phpdoc/en/trunk/reference/curl/functions/curl-multi-info-read.xml 2010-04-11 10:11:07 UTC (rev 297828) +++ phpdoc/en/trunk/reference/curl/functions/curl-multi-info-read.xml 2010-04-11 10:12:27 UTC (rev 297829) @@ -54,7 +54,111 @@ <para> On success, returns an associative array for the message, &false; on failure. </para> + <para> + <table> + <title>Contents of the returned array</title> + <tgroup cols="2"> + <thead> + <row> + <entry>Key:</entry> + <entry>Value:</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>msg</literal></entry> + <entry>The <constant>CURLMSG_DONE</constant> constant. Other return values + are currently not available.</entry> + </row> + <row> + <entry><literal>result</literal></entry> + <entry>One of the <constant>CURLE_*</constant> constants. If everything is + OK, the <constant>CURLE_OK</constant> will be the result.</entry> + </row> + <row> + <entry><literal>handle</literal></entry> + <entry>Resource of type curl indicates the handle which it concerns.</entry> + </row> + </tbody> + </tgroup> + </table> + </para> </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>A <function>curl_multi_info_read</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$urls = array( + "http://www.cnn.com/", + "http://www.bbc.co.uk/", + "http://www.yahoo.com/" +); + +$mh = curl_multi_init(); + +foreach ($urls as $i => $url) { + $conn[$i] = curl_init($url); + curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, 1); + curl_multi_add_handle($mh, $conn[$i]); +} + +do { + $status = curl_multi_exec($mh, $active); + $info = curl_multi_info_read($mh); + if (false !== $info) { + var_dump($info); + } +} while ($status === CURLM_CALL_MULTI_PERFORM || $active); + +foreach ($urls as $i => $url) { + $res[$i] = curl_multi_getcontent($conn[$i]); + curl_close($conn[$i]); +} + +var_dump(curl_multi_info_read($mh)); + +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +array(3) { + ["msg"]=> + int(1) + ["result"]=> + int(0) + ["handle"]=> + resource(5) of type (curl) +} +array(3) { + ["msg"]=> + int(1) + ["result"]=> + int(0) + ["handle"]=> + resource(7) of type (curl) +} +array(3) { + ["msg"]=> + int(1) + ["result"]=> + int(0) + ["handle"]=> + resource(6) of type (curl) +} +bool(false) +]]> + </screen> + </example> + </para> + </refsect1> <refsect1 role="changelog"> &reftitle.changelog;

« previous php.doc.cvs (#6368) next »