What Is a Cookie
This section describes what is a cookie - a piece of information sent by a Web server to a browser. The server expects the browser to send all cookies back to the server.
What Is a Cookie? A cookie is a piece of information sent by a Web server to
a Web browser, saved by the browser, and sent back to the server later.
Cookies are transmitted inside the HTTP header.
Cookies move from server to browser and back to server as shown in the following diagram:
Web Web Local Web Web
Server Browser System Browser Server
Send Receive Save Send back Receive
cookies --> cookies --> cookies --> cookies --> cookies
As you can see from the diagram, cookies are actually saved by the local system
in memory or on the hard disk of Web browser user's machines.
Many users are concerned about this. But I think it is pretty safe to allow your browser to save cookies.
If you are really concerned, you can change your browser's settings to reject
cookies. But this may cause many Web based applications fail to run on your
Cookies are mainly used to pass information from one PHP script to the next script.
Table of Contents
About This Book
Introduction and Installation of PHP
PHP Script File Syntax
PHP Data Types and Data Literals
Variables, References, and Constants
Expressions, Operations and Type Conversions
Conditional Statements - "if" and "switch"
Loop Statements - "while", "for", and "do ... while"
Function Declaration, Arguments, and Return Values
Arrays - Ordered Maps
Interface with Operating System
Introduction of Class and Object
Integrating PHP with Apache Web Server
Retrieving Information from HTTP Requests
Creating and Managing Sessions in PHP Scripts
►Sending and Receiving Cookies in PHP Scripts
►What Is a Cookie
Sending and Receiving Cookies
Sending and Receiving Cookies - Example
ob_start() - Output Buffering Function
Persistent Cookies Saved on Hard Disk
Other Cookie Properties - Domain and Path
Controlling HTTP Response Header Lines in PHP Scripts
Managing File Upload
MySQL Server Connection and Access Functions
Functions to Manage Directories, Files and Images
SOAP Extension Function and Calling Web Services
SOAP Server Functions and Examples
Localization Overview of Web Applications
Using Non-ASCII Characters in HTML Documents
Using Non-ASCII Characters as PHP Script String Literals
Receiving Non-ASCII Characters from Input Forms
"mbstring" Extension and Non-ASCII Encoding Management
Managing Non-ASCII Character Strings with MySQL Servers
Parsing and Managing HTML Documents
Configuring and Sending Out Emails
Image and Picture Processing
Managing ZIP Archive Files
Managing PHP Engine and Modules on macOS
Managing PHP Engine and Modules on CentOS
Full Version in PDF/EPUB