cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: cURL and central authentication service

From: Anderson Ellis <dakoellis_at_gmail.com>
Date: Wed, 29 Jun 2011 15:51:33 -0700

On Mon, Jun 27, 2011 at 6:20 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Sun, 26 Jun 2011, Anderson Ellis wrote:
>
> I've been looking for answers for a few days and can't really get
>> anywhere. I'm still new to curl, and trying to figure out how it works
>> exactly. Specifically, I want to know if it is possible to post to web page
>> forms behind CAS login pages.
>>
>
> curl supports numerous different HTTP authentication methods and you can do
> plain HTTP post logins with it. It really doesn't matter what kind of system
> that is behind the site as long as it uses one of the supported methods.
>
>
> - curl -c cookies.txt -b cookies.txt -d
>> "username=xxx&password=xxxx&**lt=xxxxxx&_eventId=submit" pageIwant.com
>>
>> this returned nothing
>>
>
> Use -v to see the details. Use --trace-ascii to see ALL details.

I used the -v and did not understand the output completely.

>
>
> so I added the -L option, and it returned an html page that redirected to
>> the cas login page.
>>
>
> That indicates something in your request isn't like it would be when a
> browser does the request: cookies, user-agent, referer or more. Work on
> making your request more similar to that of a browser doing the same thing.
>

How can I make it send just as a browser would? In a browser, I would go
straight to the website, enter my credentials, and be sent to the correct
page, with any UA i've tried. I saw online that to make sure you send the
necessary form fields, just download the page and change the POST to GET,
then take everything after the "?" and add that to the -d option. The
difference that I see is that when using a browser, there is no lt field,
which I am guessing means its hidden, and I tried different credentials from
the page I edited and it doesn't change based on what the user enters.
That's where I got the line at the top.

My understanding is that I use the get page to collect the information
needed, then put that into curl using the line above and it creates a cookie
file that I can use to do what I need to. Is this incorrect?

>
> A tutorial on this: http://curl.haxx.se/docs/**httpscripting.html<http://curl.haxx.se/docs/httpscripting.html>
>
> --
>
> / daniel.haxx.se
> ------------------------------**------------------------------**-------
> List admin: http://cool.haxx.se/list/**listinfo/curl-users<http://cool.haxx.se/list/listinfo/curl-users>
> FAQ: http://curl.haxx.se/docs/faq.**html<http://curl.haxx.se/docs/faq.html>
> Etiquette: http://curl.haxx.se/mail/**etiquette.html<http://curl.haxx.se/mail/etiquette.html>
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-30