|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
2 |
| -<!-- EN-Revision: b7f8c11e56ff1c57a2993e2ed7e5c5ace18637fd Maintainer: pastore Status: ready --> |
| 2 | +<!-- EN-Revision: 92226911a09278dd440b836583bf382c629cfc63 Maintainer: pastore Status: ready --> |
3 | 3 | <!-- CREDITS: darvina -->
|
4 | 4 | <refentry xml:id="function.curl-multi-add-handle" xmlns="http://docbook.org/ns/docbook">
|
5 | 5 | <refnamediv>
|
|
55 | 55 | </tgroup>
|
56 | 56 | </informaltable>
|
57 | 57 | </refsect1>
|
58 |
| - |
59 |
| - <refsect1 role="examples"> |
60 |
| - &reftitle.examples; |
61 |
| - <para> |
62 |
| - <example> |
63 |
| - <title>Esempio di <function>curl_multi_add_handle</function></title> |
64 |
| - <para> |
65 |
| - Questo esempio creerà due gestori di cURL, gli aggiungerà al gestore |
66 |
| - multiplo, e successivamente li eseguirà in modo asincrono. |
67 |
| - </para> |
68 |
| - <programlisting role="php"> |
69 |
| -<![CDATA[ |
70 |
| -<?php |
71 |
| -// crea entrambe le risorse cURL |
72 |
| -$ch1 = curl_init(); |
73 |
| -$ch2 = curl_init(); |
74 |
| -
|
75 |
| -// imposta l'URL e altre opzioni appropriate |
76 |
| -curl_setopt($ch1, CURLOPT_URL, "http://www.example.com/"); |
77 |
| -curl_setopt($ch1, CURLOPT_HEADER, 0); |
78 |
| -curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/"); |
79 |
| -curl_setopt($ch2, CURLOPT_HEADER, 0); |
80 |
| -
|
81 |
| -//crea il gestore cURL multiplo |
82 |
| -$mh = curl_multi_init(); |
83 |
| -
|
84 |
| -//aggiunge i due gestori |
85 |
| -curl_multi_add_handle($mh,$ch1); |
86 |
| -curl_multi_add_handle($mh,$ch2); |
87 | 58 |
|
88 |
| -//esegue i gestori multiplo |
89 |
| -do { |
90 |
| - $status = curl_multi_exec($mh, $active); |
91 |
| - if ($active) { |
92 |
| - curl_multi_select($mh); |
93 |
| - } |
94 |
| -} while ($active && $status == CURLM_OK); |
95 |
| -
|
96 |
| -//chiude tutti i gestori |
97 |
| -curl_multi_remove_handle($mh, $ch1); |
98 |
| -curl_multi_remove_handle($mh, $ch2); |
99 |
| -curl_multi_close($mh); |
100 |
| -?> |
101 |
| -]]> |
102 |
| - </programlisting> |
103 |
| - </example> |
104 |
| - </para> |
105 |
| - </refsect1> |
106 |
| - |
107 | 59 | <refsect1 role="seealso">
|
108 | 60 | &reftitle.seealso;
|
109 | 61 | <para>
|
|
0 commit comments