2013-05-15 21:23:52 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="function.curl-escape" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>curl_escape</refname>
|
|
|
|
<refpurpose>URL encodes the given string</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
2020-11-02 15:52:35 +00:00
|
|
|
<type class="union"><type>string</type><type>false</type></type><methodname>curl_escape</methodname>
|
2020-11-25 00:58:58 +00:00
|
|
|
<methodparam><type>CurlHandle</type><parameter>handle</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
2013-05-15 21:23:52 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2013-06-10 22:05:53 +00:00
|
|
|
This function URL encodes the given string according to <link xlink:href="&url.rfc;3986">RFC 3986</link>.
|
2013-05-15 21:23:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<variablelist>
|
|
|
|
&curl.ch.description;
|
|
|
|
<varlistentry>
|
2020-11-25 00:58:58 +00:00
|
|
|
<term><parameter>string</parameter></term>
|
2013-05-15 21:23:52 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2013-06-10 22:05:53 +00:00
|
|
|
The string to be encoded.
|
2013-05-15 21:23:52 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2013-06-15 12:59:41 +00:00
|
|
|
Returns escaped string&return.falseforfailure;.
|
2013-05-15 21:23:52 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2020-11-25 00:58:58 +00:00
|
|
|
<refsect1 role="changelog">
|
|
|
|
&reftitle.changelog;
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Version;</entry>
|
|
|
|
<entry>&Description;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
&curl.changelog.handle-param;
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</refsect1>
|
|
|
|
|
2013-06-10 22:05:53 +00:00
|
|
|
<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>
|
|
|
|
|
2013-05-15 21:23:52 +00:00
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|