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 18:47:40 -0600

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 <qljune_at_yahoo.com> wrote:
> will it differ by much if I am usung a windows machine instead?
>
> Ralph Mitchell <ralphmitchell_at_gmail.com> 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
>
> On 1/5/06, June Qiu wrote:
> > Not sure whether I did it right though. But I did it 2 ways:
> >
> > 1) Signed in and went to find the cookie file(me_at_hp.txt) in temp folder
> and
> > used that in place of 'cookie' in the command line
> > 2) ran the first command and then the written 'cookie' is saved and reused
> > in the second command with the https-webpage
> >
> > I think I'm wrong, please help!
> >
> > Ralph Mitchell wrote:
> > You *did* go to the initial page first and pick up the cookies, right??
> >
> > Ralph Mitchell
> >
> >
> > On 1/5/06, June Qiu wrote:
> > > Seems like it is not as easy as i thgt...
> > > When I typed:
> > >
> > > curl -x AAA -U BBB -v -s -S -L -o a.html -b cookies -c cookies -d
> > > "F_USERID=CCC&F_PASSWORD=DDD&f_RememberMe=false"
> > >
> >
> "https://www2.itrc.hp.com/service/ciss/doLogin.do?TargetPage=http://www2.itrc.hp.com/service/cki/docDisplay.do?docId=hpuxSecurityMatrix"
> > >
> > >
> > > I got:
> > > * Connection #0 left intact
> > > curl: (52) Empty reply from server
> > > * Closing connection #1
> > > * Closing connection #2
> > > * Closing connection #0
> > >
> > >
> > > Ralph Mitchell wrote:
> > > You'll need to find the line in a.html that contains
> > >
> > > form name="loginform" method="POST" action="https://..........."
> > >
> > > and extract the action url. That's the url you need to post back to.
> > > You may also need to add "&f_RememberMe=false" (or =true), because
> > > the server may expect to see it.
> > >
> > > -s means silent - don't show progress meter or error messages
> > > -S means do show error messages anyway, in spite of the -s> >
> > > A! ssuming you're running this in a script, you won't want the progress
> > > bar to be displayed...
> > >
> > > Ralph
> > >
> > >
> > > On 1/4/06, June Qiu wrote:
> > > > yes. :) Theoretically, I should get that info at the very least. Then
> am
> > I
> > > > right to say that by adding -d "f_UserID=abc&f_Password=123" I should
> be
> > > > able to curl in my desired page?
> > > >
> > > > ps. What is the -s and -S for?
> > > >
> > > > Ralph Mitchell wrote:
> > > > When I try
> > > >
> > > > curl -v -s -S -L -o a.html -b cookies -c cookies
> > > >
> > >
> >
> "http://www2.itrc.hp.com/service/cki/docDisplay.do?docId=hpuxSecurityMatrix"
> > > >
> > > > I get 5 cookies and two redirects. The second redirect sends me back
> > > > to www2.itrc.hp.com, but the url now has "admit=" and a bunch of
> > > > numbers inserted. The inout fields in a.html include
> > > >
> > > > User ID or E-mail: input name=f_UserID
> > > > Password: input name=f_Password
> > > >
> > > > There's also a "remember me" checkbox, some hidden fields and some
> > > > associated with searchin! g for stuff.
> > > >
> > > > Is that about what you were expecting??
> > > >
> > > > Ralph Mitchell
> >
> >
> >
> >
> >
> > ________________________________
> > Yahoo! Photos
> > Ring in the New Year with Photo Calendars. Add photos, events, holidays,
> > whatever.
> >
> >
>
>
>
>
> ________________________________
> Yahoo! Photos
> Ring in the New Year with Photo Calendars. Add photos, events, holidays,
> whatever.
>
>
Received on 2006-01-06