reference/curl/functions/curl-multi-init.xml
65d5499d46b23f4e1e4442146cd3ff585d2a91f4
...
...
@@ -9,8 +9,8 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>resource</type><methodname>curl_multi_init</methodname>
13
-
<void />
12
+
<type>CurlMultiHandle</type><methodname>curl_multi_init</methodname>
13
+
<void/>
14
14
</methodsynopsis>
15
15
<para>
16
16
Allows the processing of multiple cURL handles asynchronously.
...
...
@@ -25,10 +25,33 @@
25
25
<refsect1 role="returnvalues">
26
26
&reftitle.returnvalues;
27
27
<para>
28
-
Returns a cURL multi handle resource on success, &false; on failure.
28
+
Returns a cURL multi handle.
29
29
</para>
30
30
</refsect1>
31
31
32
+
<refsect1 role="changelog">
33
+
&reftitle.changelog;
34
+
<informaltable>
35
+
<tgroup cols="2">
36
+
<thead>
37
+
<row>
38
+
<entry>&Version;</entry>
39
+
<entry>&Description;</entry>
40
+
</row>
41
+
</thead>
42
+
<tbody>
43
+
<row>
44
+
<entry>8.0.0</entry>
45
+
<entry>
46
+
On success, this function returns a <classname>CurlMultiHandle</classname> instance now;
47
+
previously, a <type>resource</type> was returned.
48
+
</entry>
49
+
</row>
50
+
</tbody>
51
+
</tgroup>
52
+
</informaltable>
53
+
</refsect1>
54
+

32
55
<refsect1 role="examples">
33
56
&reftitle.examples;
34
57
<para>
...
...
@@ -58,19 +81,13 @@ $mh = curl_multi_init();
58
81
curl_multi_add_handle($mh,$ch1);
59
82
curl_multi_add_handle($mh,$ch2);
60
83

61
-
$active = null;
62
-
//execute the handles
84
+
//execute the multi handle
63
85
do {
64
-
$mrc = curl_multi_exec($mh, $active);
65
-
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
66
-

67
-
while ($active && $mrc == CURLM_OK) {
68
-
if (curl_multi_select($mh) != -1) {
69
-
do {
70
-
$mrc = curl_multi_exec($mh, $active);
71
-
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
86
+
$status = curl_multi_exec($mh, $active);
87
+
if ($active) {
88
+
curl_multi_select($mh);
72
89
}
73
-
}
90
+
} while ($active && $status == CURLM_OK);
74
91

75
92
//close the handles
76
93
curl_multi_remove_handle($mh, $ch1);
...
...
@@ -95,7 +112,6 @@ curl_multi_close($mh);
95
112
</refsect1>
96
113

97
114
</refentry>
98
-

99
115
<!-- Keep this comment at the end of the file
100
116
Local variables:
101
117
mode: sgml
102
118