php-doc-en/functions/url.xml
2000-02-01 08:25:03 +00:00

165 lines
5.1 KiB
XML

<reference id="ref.url">
<title>URL Functions</title>
<titleabbrev>URLs</titleabbrev>
<refentry id="function.base64-decode">
<refnamediv>
<refname>base64_decode</refname>
<refpurpose>Decodes data encoded with MIME base64</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>string <function>base64_decode</function></funcdef>
<paramdef>string <parameter>encoded_data</parameter></paramdef>
</funcsynopsis>
<para>
<function>Base64_decode</function> decodes
<parameter>encoded_data</parameter> and returns the original
data. The returned data may be binary.
</para>
<para>
See also: <function>base64_encode</function>, RFC-2045 section
6.8.
</para>
</refsect1>
</refentry>
<refentry id="function.base64-encode">
<refnamediv>
<refname>base64_encode</refname>
<refpurpose>Encodes data with MIME base64</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>string <function>base64_encode</function></funcdef>
<paramdef>string <parameter>data</parameter></paramdef>
</funcsynopsis>
<para>
<function>Base64_encode</function> returns
<parameter>data</parameter> encoded with base64. This encoding
is designed to make binary data survive transport through
transport layers that are not 8-bit clean, such as mail bodies.
</para>
<para>
Base64-encoded data takes about 33% more space than the original
data.</para>
<para>
See also:
<function>base64_decode</function>,
<function>chunk_split</function>,
RFC-2045 section 6.8.
</para>
</refsect1>
</refentry>
<refentry id="function.parse-url">
<refnamediv>
<refname>parse_url</refname>
<refpurpose>Parse a URL and return its components</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>array <function>parse_url</function></funcdef>
<paramdef>string <parameter>url</parameter></paramdef>
</funcsynopsis>
<para>
This function returns an associative array returning any of the
various components of the URL that are present. This includes the
"scheme", "host", "port", "user", "pass", "path", "query", and
"fragment".
</para>
</refsect1>
</refentry>
<refentry id="function.urldecode">
<refnamediv>
<refname>urldecode</refname>
<refpurpose>Decodes URL-encoded string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>string <function>urldecode</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcsynopsis>
<para>
Decodes any <literal>%<replaceable>##</replaceable></literal>
encoding in the given string. The decoded string is returned.
<example>
<title><function>Urldecode</function> example</title>
<programlisting role="php">
$a = split ('&', $querystring);
$i = 0;
while ($i &lt; count ($a)) {
$b = split ('=', $a [$i]);
echo 'Value for parameter ', htmlspecialchars (urldecode ($b [0])),
' is ', htmlspecialchars (urldecode ($b [1])), "&lt;BR>";
$i++;
}
</programlisting>
</example>
</para>
<para>
See also <function>urlencode</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.urlencode">
<refnamediv>
<refname>urlencode</refname>
<refpurpose>URL-encodes string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>string <function>urlencode</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcsynopsis>
<para>
Returns a string in which all non-alphanumeric characters except
<literal>-_.</literal> have been replaced with a percent
(<literal>%</literal>) sign followed by two hex digits and spaces
encoded as plus (<literal>+</literal>) signs. It is encoded the
same way that the posted data from a WWW form is encoded, that is
the same way as in
<literal>application/x-www-form-urlencoded</literal> media type.
This differs from the RFC1738 encoding (see
<function>rawurlencode</function>) in that for historical
reasons, spaces are encoded as plus (+) signs. This function is
convenient when encoding a string to be used in a query part of
an URL, as a convenient way to pass variables to the next page:
<example>
<title><function>Urlencode</function> example</title>
<programlisting role="php">
echo '&lt;A HREF="mycgi?foo=', urlencode ($userinput), '">';
</programlisting>
</example>
</para>
<para>
See also <function>urldecode</function>.
</para>
</refsect1>
</refentry>
</reference>
<!-- 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
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->