cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Advice on curling a itrc.hp.com page

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Thu, 5 Jan 2006 20:52:13 -0600

grep prints out lines from a file that match an expression or
character string. In this particular case, you need to extract the
line matching "loginForm". sed is a stream editor that applies edits
to every line passed through it.

Ralph

On 1/5/06, June Qiu <qljune_at_yahoo.com> wrote:
> right, I will try to figure out how to do it from there. But could you
> kindly elaborate what the middle line does? Not familiar with unix. Grep?
>
> Ralph Mitchell <ralphmitchell_at_gmail.com> wrote:
> You'll probably have to do the middle line a different way, because
> Windows doesn't come with grep or sed. I think you can *get* them,
> from somewhere, but I don't use Windows often enough to need them, so
> I can't tell you where.
>
> Ralph
>
>
> On 1/5/06, June Qiu wrote:
> > will it differ by much if I am usung a windows machine instead?
> >
> > Ralph Mitchell wrote:
> > I'm not sure what you mean by "find the cookie file". You use curl to
> > get the initial page, extract the login form action url, then use curl
> > again to post the login. Assuming you're ! on some kind of Unix-like
> > machine, you should be doing something like this:
> >
> > curl -s -S -L -o a.html -b cookies -c cookies
> >
> "http://www2.itrc.hp.com/service/cki/docDisplay.do?docId=hpuxSecurityMatrix"
> > action=`grep loginForm a.html | sed -e 's/^.*action="//' -e 's/".*$//'`
> > curl -s -S -L -o b.html -b cookies -c cookies -d
> > "F_USERID=CCC&F_PASSWORD=DDD&f_RememberMe=false"
> "$action"
> >
> > Once that completes, b.html is likely to match whatever you see in a
> > browser after logging in.
> >
> > Ralph Mitchell
Received on 2006-01-06