Forum Moderators: coopster & phranque

Message Too Old, No Replies

Cookie Problem

unable to fetch data from cookie

         

samir_zs

12:04 pm on Apr 28, 2003 (gmt 0)



I am using the following code to write a cookie. That is working fine.
-------------
test_local.pl
-------------
#!perl
use CGI::Cookie;
use CGI::Carp qw(fatalsToBrowser);

$cookie1 = new CGI::Cookie(-name=>'samir',-value=>'alpha334loggedinzulu216589limalinebeta470087',-expires=>'+30d');
print "Set-Cookie: $cookie1\n";
print "Location:http://localhost:90/cgi-bin/list/test_local2.pl\n\n";
----------------
test_local2.pl
-----------------
#!perl
print "Content-type: text/html\n\n";
use CGI::Carp qw(fatalsToBrowser);
print "test_local2<BR><BR><BR>";
print $ENV{'HTTP_COOKIE'};
----------------------
i can seen the cookie created in cookies folder, but i am not able to get the data from it.

plz help me out.
thank you.

samir

gethan

12:10 am on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Samir,

Your problem is that cookies can only be sent back to domains with two levels... (or two dots)

from [cookiecentral.com...]

Cookies can be assigned to individual machines, or to an entire Internet domain. The only restrictions on this value is that it must contain at least two dots (.myserver.com, not myserver.com) for the normal top-level domains, or three dots for the "extended" domains (.myserver.ny.us, not myserver.ny.us)

To get round this use your ip address for setting and browsing on your development box 127.0.0.1

Good luck