2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 06:43:42 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.curl-multi-init" xmlns="http://docbook.org/ns/docbook">
|
2007-01-16 20:18:05 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>curl_multi_init</refname>
|
|
|
|
<refpurpose>Returns a new cURL multi handle</refpurpose>
|
|
|
|
</refnamediv>
|
2007-01-17 00:14:52 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-01-16 20:18:05 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>resource</type><methodname>curl_multi_init</methodname>
|
|
|
|
<void />
|
|
|
|
</methodsynopsis>
|
2007-06-01 03:01:42 +00:00
|
|
|
<para>
|
2014-11-05 09:18:06 +00:00
|
|
|
Allows the processing of multiple cURL handles asynchronously.
|
2007-06-01 03:01:42 +00:00
|
|
|
</para>
|
2007-01-16 20:18:05 +00:00
|
|
|
</refsect1>
|
2007-01-17 00:14:52 +00:00
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
2011-02-17 09:39:02 +00:00
|
|
|
&no.function.parameters;
|
2007-01-17 00:14:52 +00:00
|
|
|
</refsect1>
|
|
|
|
|
2007-06-01 03:01:42 +00:00
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2009-07-23 02:49:49 +00:00
|
|
|
Returns a cURL multi handle resource on success, &false; on failure.
|
2007-06-01 03:01:42 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>curl_multi_init</function> example</title>
|
|
|
|
<para>
|
|
|
|
This example will create two cURL handles, add them to a multi
|
2014-11-05 09:18:06 +00:00
|
|
|
handle, and process them asynchronously.
|
2007-06-01 03:01:42 +00:00
|
|
|
</para>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
// create both cURL resources
|
|
|
|
$ch1 = curl_init();
|
|
|
|
$ch2 = curl_init();
|
|
|
|
|
|
|
|
// set URL and other appropriate options
|
2011-06-30 08:15:06 +00:00
|
|
|
curl_setopt($ch1, CURLOPT_URL, "http://lxr.php.net/");
|
2007-06-07 01:55:00 +00:00
|
|
|
curl_setopt($ch1, CURLOPT_HEADER, 0);
|
|
|
|
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
|
|
|
|
curl_setopt($ch2, CURLOPT_HEADER, 0);
|
2007-06-01 03:01:42 +00:00
|
|
|
|
|
|
|
//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);
|
|
|
|
|
2019-02-28 22:00:16 +00:00
|
|
|
//execute the multi handle
|
2007-06-07 01:55:00 +00:00
|
|
|
do {
|
2019-02-28 22:00:16 +00:00
|
|
|
$status = curl_multi_exec($mh, $active);
|
|
|
|
if ($active) {
|
|
|
|
curl_multi_select($mh);
|
2011-06-30 08:15:06 +00:00
|
|
|
}
|
2019-02-28 22:00:16 +00:00
|
|
|
} while ($active && $status == CURLM_OK);
|
2007-06-01 03:01:42 +00:00
|
|
|
|
|
|
|
//close the handles
|
2008-09-04 02:35:09 +00:00
|
|
|
curl_multi_remove_handle($mh, $ch1);
|
|
|
|
curl_multi_remove_handle($mh, $ch2);
|
2007-06-02 21:23:05 +00:00
|
|
|
curl_multi_close($mh);
|
2007-06-01 03:01:42 +00:00
|
|
|
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2007-01-17 00:14:52 +00:00
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member><function>curl_init</function></member>
|
|
|
|
<member><function>curl_multi_close</function></member>
|
|
|
|
</simplelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2007-01-16 20:18:05 +00:00
|
|
|
</refentry>
|
2003-05-10 22:18:33 +00:00
|
|
|
|
|
|
|
<!-- 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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2003-05-10 22:18:33 +00:00
|
|
|
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
|
|
|
|
-->
|