mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 18:38:55 +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
137 lines
3.3 KiB
XML
137 lines
3.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.curl-multi-add-handle" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>curl_multi_add_handle</refname>
|
|
<refpurpose>Add a normal cURL handle to a cURL multi handle</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>curl_multi_add_handle</methodname>
|
|
<methodparam><type>CurlMultiHandle</type><parameter>multi_handle</parameter></methodparam>
|
|
<methodparam><type>CurlHandle</type><parameter>handle</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Adds the <parameter>handle</parameter> handle to the multi handle
|
|
<parameter>multi_handle</parameter>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
&curl.mh.description;
|
|
&curl.ch.description;
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns 0 on success, or one of the <constant>CURLM_XXX</constant> errors
|
|
code.
|
|
</para>
|
|
</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;
|
|
&curl.changelog.handle-param;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>curl_multi_add_handle</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://www.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) {
|
|
curl_multi_select($mh);
|
|
}
|
|
} while ($active && $status == CURLM_OK);
|
|
|
|
//close all 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_remove_handle</function></member>
|
|
<member><function>curl_multi_init</function></member>
|
|
<member><function>curl_init</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
|
|
-->
|