php-doc-en/reference/http/functions/parsers/http-parse-cookie.xml

169 lines
3.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
<refentry id="function.http-parse-cookie">
<refnamediv>
<refname>http_parse_cookie</refname>
<refpurpose>Parse HTTP cookie</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>object</type><methodname>http_parse_cookie</methodname>
<methodparam choice="opt"><type>string</type><parameter>cookie</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>allowed_extras</parameter></methodparam>
</methodsynopsis>
<para>
Parses HTTP cookies like sent in a response into a struct.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>cookie</parameter></term>
<listitem>
<para>
String containing the value of a <literal>Set-Cookie</literal> response header
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>flags</parameter></term>
<listitem>
<para>
Parse flags
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>allowed_extras</parameter></term>
<listitem>
<para>
Array containing recognized <emphasis>extra</emphasis> keys.
By default all unknown keys will be treated as cookie names.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an stdClass like shown in the example on success or FALSE on failure.
</para>
</refsect1>
<!-- Use when ERRORS exist
<refsect1 role="errors">
&reftitle.errors;
<para>
When does this function throw E_* level errors, or exceptions?
</para>
</refsect1>
-->
<!-- Use when a CHANGELOG exists
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>Enter the PHP version of change here</entry>
<entry>Description of change</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
-->
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Using <function>http_parse_cookie</function></title>
<programlisting role="php">
<![CDATA[
<?php
print_r(http_parse_cookie("foo=bar; bar=baz; path=/; domain=example.com; comment=; secure", 0, array("comment")));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
stdClass Object
(
[cookies] => Array
(
[foo] => bar
[bar] => baz
)
[extras] => Array
(
[comment] =>
)
[flags] => 16
[expires] => 0
[path] => /
[domain] => example.com
)
]]>
</screen>
</example>
</para>
</refsect1>
<!-- Use when adding See Also links
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function></function></member>
<member>Or <link linkend="somethingelse">something else</link></member>
</simplelist>
</para>
</refsect1>
-->
</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:"../../../../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
-->