tomazos has asked for the wisdom of the Perl Monks concerning the following question:
I setup a script using LWP::UserAgent to do this, but it did not work because the server that the page is on requires the HTTP client to accept a cookie. It appears that LWP::UserAgent does not do this by default.
My code is as follows:
Is it possible to tell LWP::UserAgent to accept a cookie? If not, is there another way of doing what I am trying to do?use strict; use warnings; use LWP::UserAgent; my $ua = new LWP::UserAgent; $ua->agent("Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)"); my $req = new HTTP::Request GET => 'http://groups.yahoo.com/group/some +group/message/1243'; my $res = $ua->request($req); if ($res->is_success) { my $pagecontent = $res->content; } else { print "Bad luck this time\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP::UserAgent and Cookies
by athomason (Curate) on Dec 12, 2001 at 02:06 UTC | |
by IlyaM (Parson) on Dec 12, 2001 at 03:54 UTC | |
by jczeus (Monk) on Oct 27, 2021 at 08:37 UTC | |
by hippo (Archbishop) on Oct 27, 2021 at 09:06 UTC | |
by jczeus (Monk) on Oct 27, 2021 at 11:13 UTC | |
|
(ichimunki) Re: LWP::UserAgent and Cookies
by ichimunki (Priest) on Dec 12, 2001 at 02:10 UTC | |
|
Re: LWP::UserAgent and Cookies
by Aighearach (Initiate) on Dec 12, 2001 at 02:15 UTC |