| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 
 |  <reference id="ref.http">
  <title>Functions related to HTTP</title>
  <titleabbrev>HTTP</titleabbrev>
  <partintro>
  <simpara>
	These functions let you manipulate the output sent back to the
	remote browser right down to the HTTP protocol level.
  </partintro>
  <refentry id="function.header">
   <refnamediv>
    <refname>header</refname>
    <refpurpose>Send a raw HTTP header</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>header</function></funcdef>
     <paramdef>string <parameter>string</parameter></paramdef>
    </funcsynopsis>
    <para>
     The <function>Header</function> function is used at the top of an
     <acronym>HTML</acronym> file to send raw <acronym>HTTP</acronym>
     header strings.  See the <ulink url="&spec.http1.1;">HTTP 1.1
     Specification</ulink> for more information on raw http headers.
     <emphasis>Note:</emphasis> Remember that the
     <function>Header</function> function must be called before any actual
     output is sent either by normal HTML tags or from PHP. It is a very
     common error to read code with <function>include</function> or with 
     auto_prepend and have spaces or empty lines in this code that force
     output before <function>header</function> is called.
    <para>
     <informalexample><programlisting role=php>
Header("Location: http://www.php.net");  /* Redirect browser to PHP web site */
exit;  /* Make sure that code below does not get executed when we redirect. */
</programlisting></informalexample>
    <para>
     PHP scripts often generate dynamic HTML that must not be cached
     by the client browser or any proxy caches between the server and the
     client browser. Many proxies and clients can be forced to disable
     caching with
     <informalexample><programlisting role=php>
  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");             // Date in the past
  header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); // always modified
  header("Cache-Control: no-cache, must-revalidate");           // HTTP/1.1
  header("Pragma: no-cache");                                   // HTTP/1.0
</programlisting></informalexample>
   </refsect1>
  </refentry>
  <refentry id="function.setcookie">
   <refnamediv>
    <refname>setcookie</refname>
    <refpurpose>Send a cookie</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>setcookie</function></funcdef>
     <paramdef>string <parameter>name</parameter></paramdef>
     <paramdef>string <parameter>value</parameter></paramdef>
     <paramdef>int <parameter>expire</parameter></paramdef>
     <paramdef>string <parameter>path</parameter></paramdef>
     <paramdef>string <parameter>domain</parameter></paramdef>
     <paramdef>int <parameter>secure</parameter></paramdef>
    </funcsynopsis>
    <para>
     <function>SetCookie</function> defines a cookie to be sent along
     with the rest of the header information.  All the arguments
     except the <parameter>name</parameter> argument are optional.  If
     only the name argument is present, the cookie by that name will
     be deleted from the remote client.  You may also replace any
     argument with an empty string (<emphasis>""</emphasis>)
     in order to skip that argument.  The
     <parameter>expire</parameter> and <parameter>secure</parameter>
     arguments are integers and cannot be skipped with an empty
     string.  Use a zero (<emphasis>0</emphasis>) instead.  The
     <parameter>expire</parameter> argument is a regular Unix time
     integer as returned by the <function>time</function> or
     <function>mktime</function> functions.  The
     <parameter>secure</parameter> indicates that the cookie should
     only be transmitted over a secure HTTPS connection.  Some
     examples follow:
     <example>
      <title>SetCookie examples</title>
      <programlisting role=php>
SetCookie("TestCookie","Test Value");
SetCookie("TestCookie",$value,time()+3600);  /* expire in 1 hour */
SetCookie("TestCookie",$value,time()+3600,"/~rasmus/",".utoronto.ca",1);
</programlisting></example>
    <para>
     Note that the value portion of the cookie will automatically be
     urlencoded when you send the cookie, and when it is received, it
     is automatically decoded and assigned to a variable by the same
     name as the cookie name.  ie. to see the contents of our test
     cookie in a script, simply do:
<informalexample><programlisting role=php>
echo $TestCookie;
</programlisting></informalexample>
    <para>
     For more information on cookies, see Netscape's cookie
     specification at <ulink url="&spec.cookies;">&spec.cookies;</ulink>.
   </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:
-->
 |