cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: problem with post https

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Wed, 23 Nov 2011 07:52:49 -0500

On Wed, Nov 23, 2011 at 4:56 AM, mierda tuti <mierdatuti_at_gmail.com> wrote:

> Thanks again Dan
>
> I fix the User-Agent string and the Referer. I look for hidden fields but
> I don't find nothing. In Live HTTP Headers I see:
> https://www.sportstracklive.com/signin
> *
> POST /signin HTTP/1.1
> Host: www.sportstracklive.com
> User-Agent: Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.9.2.3)
> Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 115
> Connection: keep-alive
> Referer: https://www.sportstracklive.com/signin
> Cookie: JSESSIONID=FCDA2111841AE860F261B315634BBE84;
> __utma=213534422.2013686047.1322041324.1322041324.1322041324.1;
> __utmb=213534422.1.10.1322041324; __utmc=213534422;
> __utmz=213534422.1322041324.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 132
> userCredentialsForm.userCredentials.email=username%40gmail.com
> &userCredentialsForm.userCredentials.password=PASSWORD&_target1=Login
> HTTP/1.1 302 Moved Temporarily
> Date: Wed, 23 Nov 2011 09:45:07 GMT
> Server: Apache/2.2.17 (CentOS)
> Pragma: No-cache
> Expires: Thu, 01 Jan 1970 00:00:00 GMT
> Cache-Control: no-cache, no-store
> Location: https://www.sportstracklive.com/user/username
> Content-Language: es-ES
> Content-Length: 0
> Connection: close
> Content-Type: text/plain; charset=UTF-8*
>
> I don't know what can I do.
>

You should do a get first, saving the session cookie, then post the login.
 That's how your browser would do it. Also, try posting to the login page,
not the signin page, because that's where the signin form wants you to go:

   curl -s -S -L -b cookies -c cookie -o siginin.html
https://www.sportstracklive.com/signin

   curl -s -S -L b cookies -c cookies -o login.html
-d userCredentialsForm.userCredentials.email=USERNAME
-d userCredentialsForm.userCredentials.password=PASSWORD -d _target1=Login
https://www.sportstracklive.com/login

You *may* still need to send the user-agent string and the referrer, but
mostly I've managed to get away without.

Ralph Mitchell

-------------------------------------------------------------------
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-11-23