Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
WGet a Page that Requires Logging in

I wish to download file from http://mbr.nlm.nih.gov/Download/MetaMapped_Medline/2011/ however in order to download the file, i need to enter password and username, which are accepted via an http form.

is there a way by which i can enter the password/username using command line?

Thanks

share|improve this question

marked as duplicate by studiohack Mar 31 '11 at 2:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 1 down vote accepted

You can login with your browser (with preferable "Remember me" option), export browser cookie (for Firefox 3.x, here is a python code to do that) and use --load-cookies with wget.

share|improve this answer

wget and curl are only capable of handling basic HTTP authentication and not custom form based authentication.

What you will need to do is first examine the HTML of the login form to find the form elements that the login system uses and the form's action, then use curl or wget to send a request in the right format (POST or GET) to the form's action URL containing the login variables and data.

That request should return a cookie containing a session key or something similar. Submitting that cookie along with any future requests should then allow you to access the pages on the site that require you to be logged in.

share|improve this answer
    
For wget you can use the --load-cookies file option to do so. –  M'vy Mar 15 '11 at 13:10

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