Thread: Set and get cookie using perl
Results 1 to 2 of 2
Related
-
set multiple cookie Forum: CGI Perl Forum
Replies: 0 -
Set-Cookie Forum: CGI Perl Forum
Replies: 1 -
Perl cookie.... Forum: CGI Perl Forum
Replies: 2 -
How can i execute a perl file within perl programming... Forum: CGI Perl Forum
Replies: 1 -
cookie problem... Forum: CGI Perl Forum
Replies: 2
-
03-15-2007, 11:22 PM #1
Set and get cookie using perl
Hello,
I am working on setting cookie on perl.
when I did hard code sample cookie in the header ...
Code:print "Set-Cookie: mycookie=testing;expires=Mon, 29-Jul-2008 15:00:00 GMT;domain=www3.cs.umanitoba.ca;path=/~umen/cgi- print "Content-type: text/html\n"; print "Pragma: no-cache\n\n";
$ENV{HTTP_COOKIES}
Why?
does anyone know how to solve this problem?
Another thing is ... if I want to set the cookie after user has log in to a page and verified with his userid and password, what I can do?
I tried to use
print header(-cookie=>"Set-Cookie: name=value ....\n");
is my code right?
Thanks
-
03-17-2007, 04:26 PM #2
Re: Set and get cookie using perl
You have the order wrong. First define the content type, then the cookie then the extra stuff if you need it.
print "content-type:text/html\n";
print "set-cookie: value=$value; path=$path; expires=$expire\n\n";
That will solve your problem.
You can set your browser to warn you when a cookie is being set, that way you know when you access the page if it is working before trying to read it.
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum