Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving a Cookie

Status
Not open for further replies.

Eloff

Programmer
Aug 29, 2001
78
CA
Okay I set a cookie with this script

#!/usr/local/bin/perl
use CGI;
$cgiobject = new CGI;

$cookie_data = 'test';

#check to see that a valid spy report was entered
if (1 == 1) {
$final_cookie=$cgiobject->cookie(-name=>'testing',
-value=>$cookie_data,
-expires=>'+6M');

print $cgiobject->header(-cookie=>$final_cookie);
}

print "cookie set, I hope!";

This script retrieves the cookie, it is a seperate script but it doesn't retrieve anything. Now i checked in my temporary internet files, the cookie was set correctly:[\B]

testing
test
1024
3656104960
29489240
3228825824
29453031
*

here's the script:

#!/usr/local/bin/perl
use CGI;
$cgiobject = new CGI;

$cookie_data=$cgiobject->cookie("testing");

print ("Content-type: text/html\n\n");

print "cookie retrieved, I hope: ";
print "$cookie_data";

It doesn't retrieve anything. Now you can run these scripts at and retcookie.cgi

Age: 17
School: Alberta Distance Learning Center
Location: British Columbia, Canada
If at first you can't succeed, try, try again. - programmer's motto.
 
come on this can't be that hard! Age: 17
School: Alberta Distance Learning Center
Location: British Columbia, Canada
If at first you can't succeed, try, try again. - programmer's motto.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top