Jasmine Lognnes Jasmine Lognnes - 4 months ago 25
Perl Question

How to wget/curl past a redirect to download content?

I would like to use

wget
,
curl
or even use Perl to download a copy of my projects each night from ShareLatex, but when I look at Network in Chrome, I see it redirects from
/login
to
/projects
in a successful login.

Because of the redirect I it flushes the Chrome network debug log, but if I do a wrong login attempt I can see what it sends. See below screenshot.

Question

Can anyone explain how I can figure out which string I should post in order to login?

Is the
_csrf
header string important?

I have no luck with

curl -s --cookie-jar cookie https://sharelatex.com/login
curl -s --cookie cookie -H 'email: my@email.com' -H 'password: mypw' https://sharelatex.com/login


as it just gives me a failed login screen.

enter image description here

Answer

Use -L option in curl:

curl -s -L -H 'email: my@email.com' -H 'password: mypw' https://sharelatex.com/login