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"; } ?>
2016-11-04, 758👍, 0💬
Popular Posts:
How to Test API as a Publisher Administrator? You can follow this tutorial to test an API operation ...
How to view API details on the Publisher Portal of an Azure API Management Service 2017 version? You...
How to use "{{...}}" Liquid Codes in "set-body" Policy Statement? The "{{...}}" Liquid Codes in "set...
How to use the "rewrite-uri" Policy Statement for an Azure API service operation? The "rewrite-uri" ...
How to access URL template parameters from "context.Request.Matched Parameters"object in Azure API P...