Tools, FAQ, Tutorials:
Viewing the Content of a Cookie File in PHP
How to View the Content of a Cookie File in PHP?
✍: FYIcenter.com
Cookie files are normal text files. You can view them with any text editor. Follow the steps below to see what is in a cookie file created by your own PHP script.
Copy the following sample script, setting_persistent_cookies.php, to your Web server:
<?php setcookie("LoginName","FYICenter"); setcookie("PreferredColor","Blue"); setcookie("CouponNumber","07470433",time()+60*60*24*7); setcookie("CouponValue","100.00",time()+60*60*24*7); print("<pre>\n"); print("2 temporary cookies were delivered.\n"); print("2 consistent cookies were delivered.\n"); if (isset($_COOKIE["LoginName"])) { $loginName = $_COOKIE["LoginName"]; print("Received a cookie named as LoginName: ".$loginName."\n"); } else { print("Did not received any cookie named as LoginName.\n"); } $count = count($_COOKIE); print("$count cookies received.\n"); foreach ($_COOKIE as $name => $value) { print " $name = $value\n"; } print("</pre>\n"); ?>
Open your IE browser to visit this page: http://localhost/setting_persistent_cookies.php. You will see:
2 temporary cookies were delivered. 2 consistent cookies were delivered. Did not received any cookie named as LoginName. 0 cookies received.
Now go to \Documents and Settings\$user\Cookies directory and open the cookie file, $user@localhost.txt. You will see:
CouponNumber 07470433 localhost/ 1024 3084847744 29787636 2404950512 29786228 * CouponValue 100.00 localhost/ 1024 3084847744 29787636 2405150512 29786228 *
⇒ Cookie Management on Firefox in PHP
⇐ Deleting Cookie Files in PHP
2016-10-30, 2253🔥, 0💬
Popular Posts:
How to access Query String parameters from "context.Request.Url.Que ry"object in Azure API Policy? Q...
How to add request body examples to my Azure API operation to make it more user friendly? If you hav...
How To Create an Array with a Sequence of Integers or Characters in PHP? The quickest way to create ...
How to register and get an application ID from Azure AD? The first step to use Azure AD is to regist...
How to Build my "sleep" Docker image from the Alpine image? I want the container to sleep for 10 hou...