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, ∼2407🔥, 0💬
Popular Posts:
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...
How To Open Standard Output as a File Handle in PHP? If you want to open the standard output as a fi...
How to build a PHP script to dump Azure AD 2.0 Authentication Response? If you are use the Azure-AD-...
How to install "C++/CLI Support" component in Visual Studio? I need to build my Visual Studio C++/CL...
How To Merge Cells in a Column? If you want to merge multiple cells vertically in a row, you need to...