in reply to Can't Automate Login To System

If POST is denied, GET is probably correct.

When I last did this, I had to allow session cookies to get a authorization page to remember my login. See HTTP::Cookies

use LWP::UserAgent; use HTTP::Cookies; my $ua = new LWP::UserAgent(); $ua->cookie_jar(HTTP::Cookies->new());
Then, do your login and it should get you past the first redirect.

(You may have to follow that redirect to get to the first page. simple_request doesn't do that, but WWW::Automate might. In either case, I just took the redirect to the homepage rather than too the login page as a sign of successful authorization and skipped right to the rest of my code.)

~J

Replies are listed 'Best First'.
Re: Re: Can't Automate Login To System
by Cody Pendant (Prior) on Dec 04, 2003 at 02:54 UTC
    Thanks, but I'm already allowing cookies, and they're being successfully created, so that's not the answer I'm afraid.

    My next strategy was going to be log in using IE, then take the cookies it set for IE and manually add them to the LWP cookies file. Or should I just give up?



    ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print

      Sorry, you didn't mention that before, and it certainly gave me trouble earlier. Just checking.

      Stealing the cookies from IE is worth a try. It should work until they expire or are logged out.

      Then again, that simply avoids the problem and pre-authorizes you. Not much of a fix to your original problem.