svn: /phpdoc/en/trunk/reference/curl/functions/ curl-escape.xml

From: Date: Mon, 10 Jun 2013 22:05:53 +0000
Subject: svn: /phpdoc/en/trunk/reference/curl/functions/ curl-escape.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-11376@lists.php.net to get a copy of this message
bjori Mon, 10 Jun 2013 22:05:53 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=330474 Log: Document curl_escape(), patch by Adam Kazimierczak: kazymjir@ gmail Changed paths: U phpdoc/en/trunk/reference/curl/functions/curl-escape.xml Modified: phpdoc/en/trunk/reference/curl/functions/curl-escape.xml =================================================================== --- phpdoc/en/trunk/reference/curl/functions/curl-escape.xml 2013-06-10 11:24:29 UTC (rev 330473) +++ phpdoc/en/trunk/reference/curl/functions/curl-escape.xml 2013-06-10 22:05:53 UTC (rev 330474) @@ -15,11 +15,9 @@ <methodparam><type>string</type><parameter>str</parameter></methodparam> </methodsynopsis> <para> - + This function URL encodes the given string according to <link xlink:href="&url.rfc;3986">RFC 3986</link>. </para> - &warn.undocumented.func; - </refsect1> <refsect1 role="parameters"> @@ -30,7 +28,7 @@ <term><parameter>str</parameter></term> <listitem> <para> - + The string to be encoded. </para> </listitem> </varlistentry> @@ -44,6 +42,49 @@ </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(); + +// Escape a string used as a GET parameter +$location = curl_escape($ch, 'Hofbräuhaus / München'); +// Result: Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen + +// Compose an URL with the escaped string +$url = "http://example.com/add_location.php?location={$location}"; +// Result: http://example.com/add_location.php?location=Hofbr%C3%A4uhaus%20%2F%20M%C3%BCnchen + +// Send HTTP request and close the handle +curl_setopt($ch, CURLOPT_URL, $url); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_exec($ch); +curl_close($ch); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>curl_unescape</function></member> + <member><function>urlencode</function></member> + <member><function>rawurlencode</function></member> + <member><link xlink:href="&url.rfc;3986">RFC 3986</link></member> + </simplelist> + </para> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file

« previous php.doc.cvs (#11376) next »