cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Login on https page

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Mon, 18 Jul 2005 23:22:52 -0500

> understand this:
> you must first do a request to gather the cookies (formslogin.asp) and
> then you must do a separate POST to Logon.fcc and include whatever
> variables and cookies it requires, just like your browser does.

Allan is correct here, just a couple more comments:

It looks like you found the "bpolMenuID" field, but there are also
two more fields named "target" and "URL" at the very bottom of the
form, that need to be appended to your CURLOPT_POSTFIELDS setting.

When you post the second request, you should probably also set
CURLOPT_REFERER to the original url of "formslogin.asp", so the
server thinks/knows that you are posting from the correct place.

Also keep a look out for "Refresh:" headers in the HTTP and
"<META Refresh>" tags in the HTML. Curl doesn't (and shouldn't)
handle those oddities, you will need to parse them out yourself
if you find any.

There is also some cookie-related javascript sourced in from
https://bancopostaonline.poste.it/poste.js, but it doesn't
look to me like it has any effect on the form submission.

HTH,
 - Jeff
Received on 2005-07-19