Skip to content

Commit fc9a0a8

Browse files
authored
curl: Remove curl_close() from all examples (#4941)
* curl: Remove `curl_close()` from all examples * curl: Remove `curl_share_close()` from all examples
1 parent b47e4be commit fc9a0a8

18 files changed

+1
-64
lines changed

reference/curl/curlfile/construct.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
180180
echo curl_exec($request);
181181
182182
var_dump(curl_getinfo($request));
183-
184-
curl_close($request);
185183
]]>
186184
</programlisting>
187185
<para>&style.procedural;</para>
@@ -202,8 +200,6 @@ curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
202200
echo curl_exec($request);
203201
204202
var_dump(curl_getinfo($request));
205-
206-
curl_close($request);
207203
]]>
208204
</programlisting>
209205
&example.outputs;

reference/curl/examples.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
<function>curl_init</function>, then you can set all your
1313
options for the transfer via the <function>curl_setopt</function>,
1414
then you can execute the session with the
15-
<function>curl_exec</function> and then you finish off
16-
your session using the <function>curl_close</function>.
15+
<function>curl_exec</function>.
1716
Here is an example that uses the cURL functions to fetch the
1817
example.com homepage into a file:
1918
<example>
@@ -32,7 +31,6 @@ curl_exec($ch);
3231
if(curl_error($ch)) {
3332
fwrite($fp, curl_error($ch));
3433
}
35-
curl_close($ch);
3634
fclose($fp);
3735
?>
3836
]]>
@@ -63,4 +61,3 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
6361
vim: et tw=78 syn=sgml
6462
vi: ts=1 sw=1
6563
-->
66-

reference/curl/functions/curl-copy-handle.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ $ch2 = curl_copy_handle($ch);
7777
7878
// grab URL (http://www.example.com/) and pass it to the browser
7979
curl_exec($ch2);
80-
81-
// close cURL resources, and free up system resources
82-
curl_close($ch2);
83-
curl_close($ch);
8480
?>
8581
]]>
8682
</programlisting>

reference/curl/functions/curl-errno.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ if(curl_errno($ch))
7171
{
7272
echo 'Curl error: ' . curl_error($ch);
7373
}
74-
75-
// Close handle
76-
curl_close($ch);
7774
?>
7875
]]>
7976
</programlisting>

reference/curl/functions/curl-error.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ else
7171
{
7272
echo 'Operation completed without any errors';
7373
}
74-
75-
// Close handle
76-
curl_close($ch);
7774
?>
7875
]]>
7976
</programlisting>

reference/curl/functions/curl-escape.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ $url = "http://example.com/add_location.php?location={$location}";
8181
curl_setopt($ch, CURLOPT_URL, $url);
8282
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
8383
curl_exec($ch);
84-
curl_close($ch);
8584
?>
8685
]]>
8786
</programlisting>

reference/curl/functions/curl-exec.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ curl_setopt($ch, CURLOPT_HEADER, 0);
8383
8484
// grab URL and pass it to the browser
8585
curl_exec($ch);
86-
87-
// close cURL resource, and free up system resources
88-
curl_close($ch);
8986
?>
9087
]]>
9188
</programlisting>

reference/curl/functions/curl-getinfo.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,6 @@ if (!curl_errno($ch)) {
277277
$info = curl_getinfo($ch);
278278
echo 'Took ', $info['total_time'], ' seconds to send a request to ', $info['url'], "\n";
279279
}
280-
281-
// Close handle
282-
curl_close($ch);
283280
?>
284281
]]>
285282
</programlisting>
@@ -306,9 +303,6 @@ if (!curl_errno($ch)) {
306303
echo 'Unexpected HTTP code: ', $http_code, "\n";
307304
}
308305
}
309-
310-
// Close handle
311-
curl_close($ch);
312306
?>
313307
]]>
314308
</programlisting>

reference/curl/functions/curl-multi-close.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
<para>
6060
<simplelist>
6161
<member><function>curl_multi_init</function></member>
62-
<member><function>curl_close</function></member>
6362
</simplelist>
6463
</para>
6564
</refsect1>

reference/curl/functions/curl-reset.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ curl_reset($ch);
6969
// Send HTTP request
7070
curl_setopt($ch, CURLOPT_URL, 'http://example.com/');
7171
curl_exec($ch); // the previously set user-agent will be not sent, it has been reset by curl_reset
72-
73-
// Close the handle
74-
curl_close($ch);
7572
?>
7673
]]>
7774
</programlisting>

0 commit comments

Comments
 (0)