I have the following code to retrieve a page from a website that needs authentication (it uses Sungard Higher Education authentication):

wget --delete-after --save-cookies cookies.txt --keep-session-cookies --post-data 'user=foo&password=bar&uuid=0x123' login.php
wget --load-cookies cookies.txt thepage.com

But the problem is that the second one doesn't work. When I run the first one, it says I was successfully logged in but I get login required on the second.

I tried matching the POST/GET calls to be exactly like that on the browser by adding --header for each header I got from the HTTP call extracted from Chrome's developer tools, but it still didn't work.

I think the problem is that the authentication isn't cookies-based, and I'm opening a new session with each wget call. How would I prevent that from happening (if that's what happening)?

I think what I want to do is send the HTTP request and basically "navigate" to the page, which I'd imagine is one wget call, but I really don't know how to do it.

  • Is there a reason you're trying to not use --keep-session-cookies? Banner might be generating a new user session with each wget which likely would cause the credentials you're providing to not be accepted. – Bratchley Dec 24 '14 at 18:30
  • @Bratchley I'm using it (see above) and how do I go about that? – Shahar Dec 24 '14 at 18:41
  • You're using it in your first command which you're saying does work for you but the second one, the one you say isn't working, is missing that option. – Bratchley Dec 24 '14 at 18:47
  • @Bratchley I tried using that as well, not working. By the way, I feel like cookies.txt is missing cookies. Although I don't think it's the issue at hand. – Shahar Dec 24 '14 at 18:49

Using the --input-file switch and feeding it a text file containing your URL(s) should allow you to use only one wget invocation/session with all the other switches you need.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.