cURL / Mailing Lists / curl-users / Single Mail

curl-users

HTTPS authentication page

From: Cris D Putnam <cdputnam_at_us.ibm.com>
Date: Wed, 6 Apr 2005 13:18:28 -0400

Hi
I am new to http programming, please point me in the right direction. I am
using the curl c library. If I want to authenticate to an HTML page that
has an HTTPS address and just two fields usename and password. What is the
correct procedure? Going to the webpage I just get a http code 200, so
it's not a challenge response like BASIC authentication. I suppose I need
to post the username and password to the page. Is that correct? Where do
I get the correct format for the data I post from the html of the login
page.

               curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
                   curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);

How can I get the variable names for the post fields without hard coding
them like I did below? Some how I need to parse the HTML for them I know
curl reads it in when I use the verbose option it prints the html to the
console.

               char *data= "Username = Joe Schmoe & Password= 1a2vbc";
               curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
                   curl_easy_setopt(curl, CURLOPT_URL, "
https://somepage/index.html");
                                        curl_easy_perform(curl);

Thank You

Cris D. Putnam
Received on 2005-04-06