Tools, FAQ, Tutorials:
Receiving a Cookie from the Browser in PHP
How To Receive a Cookie from the Browser in PHP?
✍: FYIcenter.com
If you know that a cookie has been sent to the browser when it was visiting the server previously, you can check the built-in $_COOKIE array, which contains all cookies that were sent by the server previously. The script below shows you how to pickup one cookie from the $_COOKIE and loop through all cookies in $_COOKIE:
<?php 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"); } print("All cookies received:\n"); foreach ($_COOKIE as $name => $value) { print " $name = $value\n"; } ?>
⇒ Testing Cookies on a Web Server in PHP
⇐ Sending a Cookie to the Browser in PHP
2016-11-04, 1346🔥, 0💬
Popular Posts:
How To Use an Array as a Queue in PHP? A queue is a simple data structure that manages data elements...
Why am I getting this "Docker failed to initialize" error? After installing the latest version of Do...
How To Read the Entire File into a Single String in PHP? If you have a file, and you want to read th...
What is EPUB 3.0 Metadata "dc:publisher" and "dc:rights" elements? EPUB 3.0 Metadata "dc:publisher" ...
How to register and get an application ID from Azure AD? The first step to use Azure AD is to regist...