develooper Front page | perl.libwww | Postings from March 2001

HTTP::Cookies (Urgent help needed)

Waseem Aslam
March 9, 2001 03:28
HTTP::Cookies (Urgent help needed)
Message ID:

i am trying to get cookie information from a remote
site (shoping catalog), however for this particular
site the HTTP::Cookie action has no effect. I have
tried the same code just changing the url on a number
of diffrent sites ,, and they all give diffrent results , but the
site i want to work doesnt give anything (see code for
results of tests on all sites). 

i have listed my code below if someone can help 

#!/usr/local/bin/perl -w 

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

use LWP::Simple; 
use HTTP::Request::Common qw(POST); 
use HTTP::Request::Common qw(GET); 
use LWP::UserAgent; 
use HTTP::Cookies; 

### CNN .com - the cookies.txt is updated 

#$url = ""; 

### the cookies.txt is not updated but
the cookie appears in windows/cookies 

#$url = ""; 

##### Yahoo .com - the coookies.txt file is updated. 

#$url = ""; 

### Test site using Actinic catalog - cookies.txt not
updated and cookie doesnt appear in windows/cookies 

$url =

$cookie_file = "/xxxxxxx/xxxx/cookies.txt"; 

$ua = LWP::UserAgent->new(); 
$ua->agent("Mozilla/4.51 [en]"); 

$cookie_jar = HTTP::Cookies->new( file =>
$cookie_file, ,ignore_discard => 1); 

$request = HTTP::Request->new(GET => $url); 



$response = $ua->request($request); 


#print $cookie_jar->as_string() ; 


print $response->as_string(); 



Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About