cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Login on https page

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Sun, 17 Jul 2005 09:08:38 -0500

You need to fetch the first page in order to pick up any cookies it
sends, then you need to post *all* the form variables back to the form
action url. That means all the hidden variables, as well as the
variables that display on the page.

Ralph Mitchell

On 7/17/05, Vi.Per. <vperrone_at_libero.it> wrote:
> Hi!
> I'm trying to login to that page:
> https://bancopostaonline.poste.it/bpol/bancoposta/formslogin.asp using
> libcurl in C.
>
> That is what I've done:
>
> CURL *curl;
> CURLcode res;
>
> curl = curl_easy_init();
> curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
> curl_easy_setopt(curl, CURLOPT_URL,
> "https://bancopostaonline.poste.it/bpol/bancoposta/formslogin.asp");
> curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0
> (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1
> (ax)");
> curl_easy_setopt(curl, CURLOPT_COOKIEFILE, "cookie.txt");
> curl_easy_setopt(curl, CURLOPT_COOKIEJAR, "cookie.txt");
> curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2);
> curl_easy_setopt(curl, CURLOPT_POST, 1);
> curl_easy_setopt(curl, CURLOPT_POSTFIELDS,
> "bpolMenuID=menu_login&USER=xxx&Password=xxx");
> curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
> res = curl_easy_perform(curl);
> curl_easy_cleanup(curl);
>
>
> but all I can get is the login page again...
>
> Now even if the username or password are wrong I should get the error
> page, not the login page again!
>
> Can anyone help me to get a successful login to that page?
> In the html sorce there are some hidden fields and a Logon.fcc is that
> the problem?
> Thanks
>
>
Received on 2005-07-17