Berkeley CSUA MOTD:Entry 47555
Berkeley CSUA MOTD
2019/01/22 [General] UID:1000 Activity:popular

2007/8/7-13 [Computer/SW/Languages/Perl, Computer/SW/Unix] UID:47555 Activity:nil
8/7     I'm trying to figure out whether it's possible for get wget to
        authenticate to a web page protected by a login form ('post'
        method to send username/pass, and cookies.)  Cookies don't seem
        to be the problem, with --save-cookies and --keep-session-cookies
        but getting the username/password submitted isn't doing it.  On
        this particular page, getting to a link, let's say 'example.aspx',
        redirects to 'login.aspx?href=/example.aspx'; login.aspx is a
        standard http form.  Anyone ever get this working?  -John
        \_ You want a single wget command or are you scripting this?
           If scripting just hit the logon page first to get your cookie.
           Otherwise you have to recognize you've been redirected.
        \_ Why wget?  Have you tried curl?
        \_ I've been able to get this working using wget's CLI options
           --user=[user] and --password=[passwd] or by posting the
           right form elements for authentication.
           \_ Yeah tried both, no good.  Curl sounds like it might
              work, though.  Thanks.  -John
        \_ If curl doesn't work for you, I've done this in perl before.  It
           isn't that hard with cpan's lwp, cookie libraries, etc.
           \_ Or if you hate Perl, Ruby does a good job too.
              \_ Curl works for submitting the credentials, but I'm having
                 trouble with cookies; the site issues 4 for a normal
                 browser login, but with curl I only get one.  I'll keep
                 plugging.  -John
              \_ How can you hate perl for a hack script like this?
2019/01/22 [General] UID:1000 Activity:popular

You may also be interested in these entries...
2013/10/24-2014/2/5 [Academia/Berkeley/CSUA/Motd, Computer/SW] UID:54746 Activity:nil
9/26    I remember there was web version of the motd with search function
        (originally due to kchang ?).  The last time I used it it was hosted
        on the csua website but I can't remember its url (onset of dementia?)
        now. Can somebody plz post it, tnx.
           \_ for some reason I couldn't log in since Sept and the archiver
2013/10/28-2014/2/5 [Computer/SW/Database] UID:54751 Activity:nil
10/28   Oracle software to blame for Obamacare website debacles:
        \_ Larry Ellison is a secret Tea Party supporter.
           Most of this article is bunk, btw. Boy are the Republicans
           getting desperate.
            \_ Umm, no.  Larry Ellison is a not so secret fascist.
2013/12/13-2014/2/5 [Computer/SW/Languages/Web] UID:54757 Activity:nil
        Why I love PHP.
/ You will pay for your sins. If you have \
| already paid, please disregard this     |