How To View Cookie Header Lines


How To View Cookie Header Lines? - PHP Script Tips - Understanding and Managing Cookies



If you are interested to see the cookie header lines, or you are having trouble with your cookies and need to see the cookies to help debugging, you can run your script with PHP CGI interface in a command line window. The following tutorial exercise shows you a good example:

>edit showing_cookie_header_lines.php
  setcookie("PreferredColor","Blue", NULL, "/store");
    "/store", "");
  print("4 cookies were delivered.\n");

>php-cgi showing_cookie_header_lines.php
Content-type: text/html
X-Powered-By: PHP/5.0.4
Set-Cookie: LoginName=FYICenter
Set-Cookie: PreferredColor=Blue; path=/store
Set-Cookie: CouponNumber=07470433; expires=Sun, 05 Mar 2006
  02:33:43 GMT; path=/store
Set-Cookie: CouponValue=100.00; expires=Sun, 05 Mar 2006
  02:33:43 GMT; path=/store;

4 cookies were delivered.

2007-04-24, 4816👍, 0💬