mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 10:28:54 +00:00

Amended by cmb. Closes GH-231. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@351621 c90b9560-bf6c-de11-be94-00142212c4b1
151 lines
3.8 KiB
XML
151 lines
3.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.curl-multi-exec" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>curl_multi_exec</refname>
|
|
<refpurpose>Run the sub-connections of the current cURL handle</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>curl_multi_exec</methodname>
|
|
<methodparam><type>CurlMultiHandle</type><parameter>multi_handle</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter role="reference">still_running</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Processes each of the handles in the stack. This method can be called whether or not a handle
|
|
needs to read or write data.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
&curl.mh.description;
|
|
<varlistentry>
|
|
<term><parameter>still_running</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
A reference to a flag to tell whether the operations are still running.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
A cURL code defined in the cURL <link linkend="curl.constants">Predefined Constants</link>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
This only returns errors regarding the whole multi stack. There might still have
|
|
occurred problems on individual transfers even when this function returns
|
|
<constant>CURLM_OK</constant>.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&curl.changelog.multi-handle-param;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>curl_multi_exec</function> example</title>
|
|
<para>
|
|
This example will create two cURL handles, add them to a multi
|
|
handle, and process them asynchronously.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// create both cURL resources
|
|
$ch1 = curl_init();
|
|
$ch2 = curl_init();
|
|
|
|
// set URL and other appropriate options
|
|
curl_setopt($ch1, CURLOPT_URL, "http://example.com/");
|
|
curl_setopt($ch1, CURLOPT_HEADER, 0);
|
|
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
|
|
curl_setopt($ch2, CURLOPT_HEADER, 0);
|
|
|
|
//create the multiple cURL handle
|
|
$mh = curl_multi_init();
|
|
|
|
//add the two handles
|
|
curl_multi_add_handle($mh,$ch1);
|
|
curl_multi_add_handle($mh,$ch2);
|
|
|
|
//execute the multi handle
|
|
do {
|
|
$status = curl_multi_exec($mh, $active);
|
|
if ($active) {
|
|
// Wait a short time for more activity
|
|
curl_multi_select($mh);
|
|
}
|
|
} while ($active && $status == CURLM_OK);
|
|
|
|
//close the handles
|
|
curl_multi_remove_handle($mh, $ch1);
|
|
curl_multi_remove_handle($mh, $ch2);
|
|
curl_multi_close($mh);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>curl_multi_init</function></member>
|
|
<member><function>curl_multi_select</function></member>
|
|
<member><function>curl_exec</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|