I am trying to log into my stackoverflow.com account programmatically. I tried to make a curl as shown below, but it asks for the length of the content:
$ curl -X POST --user abc@gmail.com :abc https://stackoverflow.com/users/login -v * Trying 151.101.193.69... * Connected to stackoverflow.com (151.101.193.69) port 443 (#0) * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 * Server certificate: *.stackexchange.com * Server certificate: DigiCert SHA2 High Assurance Server CA * Server certificate: DigiCert High Assurance EV Root CA * Server auth using Basic with user ' abc@gmail.com ' > POST /users/login HTTP/1.1 > Host: stackoverflow.com > Authorization: Basic YWJjQGdtYWlsLmNvbTphYmM= > User-Agent: curl/7.43.0 > Accept: */* > Content-Type:application/json > < HTTP/1.1 411 Length Required < Content-Type: text/html; charset=us-ascii < Content-Length: 344 < Accept-Ranges: bytes < Date: Sat, 10 Sep 2016 14:51:27 GMT < Via: 1.1 varnish < Connection: keep-alive < X-Served-By: cache-sin6924-SIN < X-Cache: MISS < X-Cache-Hits: 0 < X-Timer: S1473519087.232710,VS0,VE240 < X-DNS-Prefetch-Control: off < Set-Cookie: prov=b46dabec-5ba0-92ef-b6dd-884666bea467; domain=.stackoverflow.com; expires=Fri, 01-Jan-2055 00:00:00 GMT; path=/; HttpOnly < <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Length Required</TITLE> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Length Required</h2> <hr><p>HTTP Error 411. The request must be chunked or have a content length.</p> </BODY></HTML> * Connection #0 to host stackoverflow.com left intact
I also tried without POST . It returns 200, but without input.
$ curl --user abc@gmail.com :abc https://stackoverflow.com/users/login -v * Trying 151.101.193.69... * Connected to stackoverflow.com (151.101.193.69) port 443 (#0) * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 * Server certificate: *.stackexchange.com * Server certificate: DigiCert SHA2 High Assurance Server CA * Server certificate: DigiCert High Assurance EV Root CA * Server auth using Basic with user ' abc@gmail.com ' > GET /users/login HTTP/1.1 > Host: stackoverflow.com > Authorization: Basic YWJjQGdtYWlsLmNvbTphYmM= > User-Agent: curl/7.43.0 > Accept: */* > < HTTP/1.1 200 OK < Cache-Control: private < Content-Type: text/html; charset=utf-8 < X-Frame-Options: SAMEORIGIN < X-Request-Guid: cb0c93fa-9a05-4661-bc34-c4d97225b13e < Content-Length: 37753 < Accept-Ranges: bytes < Date: Sat, 10 Sep 2016 14:53:41 GMT < Via: 1.1 varnish < Age: 0 < Connection: keep-alive < X-Served-By: cache-sin6924-SIN < X-Cache: MISS < X-Cache-Hits: 0 < X-Timer: S1473519220.936412,VS0,VE257 < X-DNS-Prefetch-Control: off
How can i do this?
source share