php-doc-en/functions/url.xml
Gabor Hojtsy 0633d9dd37 Missing sort title in filepro, and moving rawurl* func to
a better place (I think...)

Hope there won't be any problem with line breaks...


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@29826 c90b9560-bf6c-de11-be94-00142212c4b1
2000-08-07 16:07:02 +00:00

253 lines
8.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>
<funcprototype>
<funcdef>string <function>base64_decode</function></funcdef>
<paramdef>string <parameter>encoded_data</parameter></paramdef>
</funcprototype>
</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>
<funcprototype>
<funcdef>string <function>base64_encode</function></funcdef>
<paramdef>string <parameter>data</parameter></paramdef>
</funcprototype>
</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>
<funcprototype>
<funcdef>array <function>parse_url</function></funcdef>
<paramdef>string <parameter>url</parameter></paramdef>
</funcprototype>
</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.rawurldecode">
<refnamediv>
<refname>rawurldecode</refname>
<refpurpose>Decode URL-encoded strings</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>rawurldecode</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns a string in which the sequences with percent
(<literal>%</literal>) signs followed by two hex digits have been
replaced with literal characters. For example, the string
<screen>foo%20bar%40baz</screen> decodes into <screen>foo
bar@baz</screen>.
</para>
<simpara>
See also <function>rawurlencode</function>,
<function>urldecode</function>,
<function>urlencode</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.rawurlencode">
<refnamediv>
<refname>rawurlencode</refname>
<refpurpose>URL-encode according to RFC1738</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>rawurlencode</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns a string in which all non-alphanumeric characters except
<screen>-_.</screen> have been replaced with a percent
(<literal>%</literal>) sign followed by two hex digits. This is
the encoding described in RFC1738 for protecting literal
characters from being interpreted as special URL delimiters, and
for protecting URL's from being mangled by transmission media
with character conversions (like some email systems). For
example, if you want to include a password in an ftp url:
<example>
<title><function>Rawurlencode</function> example 1</title>
<programlisting role="php">
echo '&lt;A HREF="ftp://user:', rawurlencode ('foo @+%/'),
'@ftp.my.com/x.txt">';
</programlisting>
</example>
Or, if you pass information in a path info component of the url:
<example>
<title><function>Rawurlencode</function> example 2</title>
<programlisting role="php">
echo '&lt;A HREF="http://x.com/department_list_script/',
rawurlencode ('sales and marketing/Miami'), '">';
</programlisting>
</example>
</para>
<simpara>
See also <function>rawurldecode</function>,
<function>urldecode</function>,
<function>urlencode</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.urldecode">
<refnamediv>
<refname>urldecode</refname>
<refpurpose>Decodes URL-encoded string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>urldecode</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</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 ('&amp;', $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>,
<function>rawurlencode</function>,
<function>rawurldecode</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.urlencode">
<refnamediv>
<refname>urlencode</refname>
<refpurpose>URL-encodes string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>urlencode</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</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>,
<function>rawurldecode</function>,
<function>rawurlencode</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:
-->