I am trying to automate a login to a website by replicating the HTTP POST request with wget. I don't really need the response data, not to mention that waiting for all of it increases the execution time of the cronjob.

I have tried to limit the amount of data I get back from server by sending a

Range: bytes=0-1

HTTP header, but apparently I'm doing it wrong, since I'm still getting hundreds of kilobytes of HTML content which I don't need.

How do I do it the right way?

  • AFAIK, there's no way to tell the server you don't need the whole response - and if you don't read the whole response, the server will wait for you to read it, during which you may not yet be logged in. Depending on how the login is done (session cookie? something else?), in your place I'd try to find a different URL to log in, which doesn't give you such a big response (and I seriously doubt it's hundreds of K, that's very unusual). Otherwise, > /dev/null. – dirkt Jul 2 '18 at 12:14

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.