hi!
i am trying to "download" a web page this way, but i keep geting a page
telling me that the cookies are not enabled in my browser, but when
retriving a page on MY website that print all the http headers, i see
that my cookis are included.
Can some one have an idear what is wrong???
here is my code.
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Cookies::Mozilla;
my $ua = LWP::UserAgent->new;
my $cookies = HTTP::Cookies::Mozilla->new(file =>
'/home/georgewbush/.mozilla/georgewbush/xchwim0v.slt/cookies.txt',
autosave => 1,);
$ua->agent('Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90)');
$ua->cookie_jar($cookies);
my $request2 = new HTTP::Request 'POST',
'http://www.awebsite.com/cgi-bin/Search.exe/Search?';
my $form_info =
q|topurl=http://www.awebsite.com/search.htm&search=honda&ID=1|; # ID and
topurl are some hiden value in the form.
$request2->content($form_info);
$request2->push_header('ACCEPT',
q|text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1|);
$request2->push_header('ACCEPT_CHARSET', q|ISO-8859-1, utf-8;q=0.66,
*;q=0.66|);
$request2->push_header('ACCEPT_ENCODING', q|gzip, deflate, compress;q=0.9|);
$request2->push_header('ACCEPT_LANGUAGE', q|en-us, en;q=0.50|);
$request2->push_header('CONNECTION', q|keep-alive|);
$request2->push_header('KEEP_ALIVE', q|300|);
$request2->push_header('REFERER', q||);
$request2->remove_header('HTTP_COOKIE2');
$request2->remove_header('CONTENT_LENGTH');
# $cookies->add_cookie_header($request2); # this dosent seems to make a
difernce when trying it on my website
$responce = $ua->request($request2);
$cookies->extract_cookies($responce);
print $responce->content;