in reply to Re^2: searching for small Cookies example but found does not work
in thread searching for small Cookies example but found does not work
print "$cookie\n"; print "Content-type: text/html\n\n"; print "Have we a cookie?????\n";
If you mean you can't see the actual cookie printed it is because you print it before sending content-type headers... Try moving all print statements you want to appear on your browser after printing content-type headers. And btw that \n\n should have been \r\n or more accurately:
... For example, most networking protocols expect and prefer a CR+LF ("\015\012" or "\cM\cJ" )
It is for these trivial mistakes that CGI can save you a lot of trouble if not time. Here is how to set a cookie on client's browser:
use CGI; my $cgi = CGI->new; my $cookie = $cgi->cookie(-name => 'CookieName', -value => 'CookieVal +ue' ...); print $cgi->header( -cookie => $cookie, -type => 'text/html'); #print "just set a cookie on you<br>" print $cgi->start_html("just set a cookie on you<br>");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: searching for small Cookies example but found does not work
by marto (Cardinal) on Jul 31, 2018 at 11:13 UTC | |
by bliako (Abbot) on Jul 31, 2018 at 11:44 UTC | |
by marto (Cardinal) on Jul 31, 2018 at 12:41 UTC | |
by bliako (Abbot) on Jul 31, 2018 at 13:48 UTC | |
by marto (Cardinal) on Jul 31, 2018 at 14:10 UTC | |
|