reference/curl/functions/curl-multi-exec.xml
b7f8c11e56ff1c57a2993e2ed7e5c5ace18637fd
...
...
@@ -10,7 +10,7 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>int</type><methodname>curl_multi_exec</methodname>
13
-
<methodparam><type>resource</type><parameter>mh</parameter></methodparam>
13
+
<methodparam><type>CurlMultiHandle</type><parameter>multi_handle</parameter></methodparam>
14
14
<methodparam><type>int</type><parameter role="reference">still_running</parameter></methodparam>
15
15
</methodsynopsis>
16
16
<para>
...
...
@@ -50,6 +50,23 @@
50
50
</note>
51
51
</refsect1>
52
52
53
+
<refsect1 role="changelog">
54
+
&reftitle.changelog;
55
+
<informaltable>
56
+
<tgroup cols="2">
57
+
<thead>
58
+
<row>
59
+
<entry>&Version;</entry>
60
+
<entry>&Description;</entry>
61
+
</row>
62
+
</thead>
63
+
<tbody>
64
+
&curl.changelog.multi-handle-param;
65
+
</tbody>
66
+
</tgroup>
67
+
</informaltable>
68
+
</refsect1>
69
+

53
70
<refsect1 role="examples">
54
71
&reftitle.examples;
55
72
<para>
...
...
@@ -57,7 +74,7 @@
57
74
<title><function>curl_multi_exec</function> example</title>
58
75
<para>
59
76
This example will create two cURL handles, add them to a multi
60
-
handle, and then run them in parallel.
77
+
handle, and process them asynchronously.
61
78
</para>
62
79
<programlisting role="php">
63
80
<![CDATA[
...
...
@@ -67,7 +84,7 @@ $ch1 = curl_init();
67
84
$ch2 = curl_init();
68
85

69
86
// set URL and other appropriate options
70
-
curl_setopt($ch1, CURLOPT_URL, "http://lxr.php.net/");
87
+
curl_setopt($ch1, CURLOPT_URL, "http://example.com/");
71
88
curl_setopt($ch1, CURLOPT_HEADER, 0);
72
89
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
73
90
curl_setopt($ch2, CURLOPT_HEADER, 0);
...
...
@@ -79,19 +96,14 @@ $mh = curl_multi_init();
79
96
curl_multi_add_handle($mh,$ch1);
80
97
curl_multi_add_handle($mh,$ch2);
81
98

82
-
$active = null;
83
-
//execute the handles
99
+
//execute the multi handle
84
100
do {
85
-
$mrc = curl_multi_exec($mh, $active);
86
-
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
87
-

88
-
while ($active && $mrc == CURLM_OK) {
89
-
if (curl_multi_select($mh) != -1) {
90
-
do {
91
-
$mrc = curl_multi_exec($mh, $active);
92
-
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
101
+
$status = curl_multi_exec($mh, $active);
102
+
if ($active) {
103
+
// Wait a short time for more activity
104
+
curl_multi_select($mh);
93
105
}
94
-
}
106
+
} while ($active && $status == CURLM_OK);
95
107

96
108
//close the handles
97
109
curl_multi_remove_handle($mh, $ch1);
...
...
@@ -117,7 +129,6 @@ curl_multi_close($mh);
117
129
</refsect1>
118
130
119
131
</refentry>
120
-

121
132
<!-- Keep this comment at the end of the file
122
133
Local variables:
123
134
mode: sgml
124
135