Hello Mailing List,
I am attaching a few new patches. Please let me know what do you think
about them.
Cheers,
Adam
Index: en/reference/curl/functions/curl-reset.xml
===================================================================
--- en/reference/curl/functions/curl-reset.xml (revision 330487)
+++ en/reference/curl/functions/curl-reset.xml (working copy)
@@ -14,11 +14,9 @@
<methodparam><type>resource</type><parameter>ch</parameter></methodparam>
</methodsynopsis>
<para>
-
+ This function re-initializes all options set on the given cURL handle to the default values.
</para>
- &warn.undocumented.func;
-
</refsect1>
<refsect1 role="parameters">
@@ -35,6 +33,54 @@
</para>
</refsect1>
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>curl_escape</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Create a curl handle
+$ch = curl_init();
+
+// Set CURLOPT_USERAGENT option
+curl_setopt($ch, CURLOPT_USERAGENT, "My test user-agent");
+
+// Reset all previously set options
+curl_reset($ch);
+
+// Send HTTP request
+curl_setopt($ch, CURLOPT_URL, 'http://example.com/');
+curl_exec($ch); // the previously set user-agent will be not send, it has been reset by curl_reset
+
+// Close the handle
+curl_close($ch);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <note>
+ <para>
+ <function>curl_reset</function> also resets the URL given as the <function>curl_init</function> parameter.
+ </para>
+ </note>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>curl_setopt</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
Index: en/reference/curl/functions/curl-strerror.xml
===================================================================
--- en/reference/curl/functions/curl-strerror.xml (revision 330487)
+++ en/reference/curl/functions/curl-strerror.xml (working copy)
@@ -4,7 +4,7 @@
<refentry xml:id="function.curl-strerror" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>curl_strerror</refname>
- <refpurpose>Return string describing error code</refpurpose>
+ <refpurpose>Return string describing the given error code</refpurpose>
</refnamediv>
<refsect1 role="description">
@@ -14,11 +14,9 @@
<methodparam><type>int</type><parameter>errornum</parameter></methodparam>
</methodsynopsis>
<para>
-
+ Returns a text error message describing the given error code.
</para>
- &warn.undocumented.func;
-
</refsect1>
<refsect1 role="parameters">
@@ -28,7 +26,7 @@
<term><parameter>errornum</parameter></term>
<listitem>
<para>
- One of <constant>CURLE_*</constant> constants.
+ One of the <link xlink:href="&url.curl.error;">cURL error codes</link> constants.
</para>
</listitem>
</varlistentry>
@@ -42,6 +40,55 @@
</para>
</refsect1>
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>curl_errno</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Create a curl handle with a mispelled protocol in URL
+$ch = curl_init("htp://example.com/");
+
+// Send request
+curl_exec($ch);
+
+// Check for errors and display the error message
+if($errno = curl_errno($ch)) {
+ $error_message = curl_strerror($errno);
+ echo "cURL error ({$errno}):\n {$error_message}";
+}
+
+// Close the handle
+curl_close($ch);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+cURL error (1):
+ Unsupported protocol
+]]>
+ </screen>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>curl_errno</function></member>
+ <member><function>curl_error</function></member>
+ <member><function>urldecode</function></member>
+ <member><function>rawurldecode</function></member>
+ <member><link xlink:href="&url.curl.error;">Curl error codes</link></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
Index: en/reference/curl/functions/curl-escape.xml
===================================================================
--- en/reference/curl/functions/curl-escape.xml (revision 330487)
+++ en/reference/curl/functions/curl-escape.xml (working copy)
@@ -38,7 +38,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- Return escaped string&return.falseforfailure;.
+ Returns escaped string or &null; on failure.
</para>
</refsect1>
Index: en/reference/curl/functions/curl-unescape.xml
===================================================================
--- en/reference/curl/functions/curl-unescape.xml (revision 330487)
+++ en/reference/curl/functions/curl-unescape.xml (working copy)
@@ -4,7 +4,7 @@
<refentry xml:id="function.curl-unescape" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>curl_unescape</refname>
- <refpurpose>URL decodes the given string</refpurpose>
+ <refpurpose>Decodes the given URL encoded string</refpurpose>
</refnamediv>
<refsect1 role="description">
@@ -15,11 +15,8 @@
<methodparam><type>string</type><parameter>str</parameter></methodparam>
</methodsynopsis>
<para>
-
+ This function decodes the given URL encoded string.
</para>
-
- &warn.undocumented.func;
-
</refsect1>
<refsect1 role="parameters">
@@ -30,7 +27,7 @@
<term><parameter>str</parameter></term>
<listitem>
<para>
-
+ The URL encoded string to be decoded.
</para>
</listitem>
</varlistentry>
@@ -40,10 +37,64 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- Return unescaped string&return.falseforfailure;.
+ Returns decoded string or &null; on failure.
</para>
</refsect1>
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title><function>curl_escape</function> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Create a curl handle
+$ch = curl_init('http://example.com/redirect.php');
+
+// Send HTTP request and follow redirections
+curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+curl_exec($ch);
+
+// Get the last effective URL
+$effective_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
+// ie. "http://example.com/show_location.php?loc=M%C3%BCnchen"
+
+// Decode the URL
+$effective_url_decoded = curl_unescape($ch, $effective_url);
+// "http://example.com/show_location.php?loc=München"
+
+// Close the handle
+curl_close($ch);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <note>
+ <para>
+ <function>curl_unescape</function> does not decode plus symbols (+) into spaces. <function>urldecode</function> does.
+ </para>
+ </note>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>curl_escape</function></member>
+ <member><function>urlencode</function></member>
+ <member><function>urldecode</function></member>
+ <member><function>rawurlencode</function></member>
+ <member><function>rawurldecode</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file