in reply to Automatically Logging in to a Webpage

Hi Monk Awohld,
I'm working on a LWP Virtual agent too. And I get a problem with "refresh page" (Have a look on other post ;)).
For the cookies purpose. I think you have to complete your code.

cookie_jar => HTTP::Cookies->new( file => 'mycook.txt', autosave => 1, ignore_discard => 1, )

The "autosave" option is used by LWP to update the cookie session automatically. The txt file is a "Cookie box". When the HTTP::Cookies will be destroy, it 'll be save in this file (And restore cookie).
The"ignore_discard" parameter save even cookies that are requested to be discarded
(Because LWP respect the RFC 2965 -> that means LWP don't discard the cookies when the script ends.)

If you have use manually your site, maybe your browser have save the cookie sessions. You can import hime by using specific module like :
HTTP::Cookies::Netscape, HTTP::Cookies::Mozilla etc

Finnaly, maybe have a look on the HTTP::Status .
I hope that'll help you. I'm very interresting in your code, i'm begginner in the part of Perl lib.

Replies are listed 'Best First'.
Re^2: Automatically Logging in to a Webpage
by awohld (Hermit) on May 24, 2005 at 16:32 UTC
    I'm going to leave the cookie field blank, so the cookies will be destroyed when the program finishes. I want a fresh login every time.

    My Virtual Agent isn't redirecting either when it gets the 302 Moved code. According to my understanding of the RFC 2616, if a user is POST'ing data and the server sends 302, the browser is supposed to ask for user confirmation that they want to be redirected.

    So I guess this is why the Virtual Agent isn't redirecting.

    Any ideas on how to fix that?