How to use setrawcookie in PHP
In this article I am going to explain about setrawcookie function in PHP.
PHP setrawcookie() Function
The HTTP setrawcookie function sends a cookie without URL encoding the cookie value.
Syntax of setrawcookie function
setrawcookie(name, value, expire, path, domain, secure) |
Parameters in setrawcookie function
It have six parameter:
Parameter |
Description |
name |
It specifies the name of the cookie. |
value |
It specifies the value of the cookie. |
expire |
It specifies when the cookie expires. |
path |
It specifies server path of the cookie. |
domain |
It specifies domain name of the cookie. |
secure |
It indicates that the cookie should only be transmitted over a secure HTTPS connection from the client. |
Example of http setrawcookie function
<html>
<body>
<?php
setrawcookie("User", "C-sharpcorner", time()+3600);
?>
</body>
</html>
|
Example of retrive a rawcookie value
<html>
<body>
<?php
echo $_COOKIE["User"];
print_r($_COOKIE);
?>
</body>
</html>
|
Output:

You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here