php-doc-en/functions/url.sgml
Sascha Schumann ec1ea24811 taken from php3/doc on 19990606
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@9477 c90b9560-bf6c-de11-be94-00142212c4b1
1999-06-06 18:51:02 +00:00

170 lines
4.9 KiB
Text

<reference id="ref.url">
<title>URL functions</title>
<titleabbrev>URLs</titleabbrev>
<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".
</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>urldecode() example</title>
<programlisting>
$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>
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 convinient way to pass variables to
the next page:
<example>
<title>urlencode() example</title>
<programlisting>
echo '&lt;A HREF="mycgi?foo=', urlencode ($userinput), '">';
</programlisting></example>
<para>
See also <function>urldecode</function></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>
Base64-encoded data takes about 33% more space than the original
data.
<para>
See also:
<function>base64_decode</function>,
<function>chunk_split</function>,
RFC-2045 section 6.8.
</refsect1>
</refentry>
<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>
See also:
<function>base64_encode</function>,
RFC-2045 section 6.8.
</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:
-->