Cookies

Netscape originated the “magic cookie” back in the days of Netscape 1. The origin of the name is the subject of some debate, although it seems reasonable to assume that the fortune cookie might have played a role in the thinking behind it. Since then, the standard has been embraced by other browser producers.

A cookie is a small amount of data stored by the user’s browser in compliance with a request from a server or script. A host can request that up to 20 cookies be stored by a user’s browser. Each cookie consists of a name, a value, and an expiry date, as well as host and path information. An individual cookie is limited to 4KB.

After a cookie is set, only the originating host can read the data, ensuring that the user’s privacy is ...

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.