I want to login into a website using a shell script and at the same time I want to automatically take the user id and the password also.
Please suggest how is it done using shell script.
Thanks !!!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If what you want to do is retrieve content from a website using HTTP Basic authentication then you can achieve this from the command line using wget or curl:
If cookie-based authentication is used you may be able to use wget for this too, depending on how it is set up. If for example you can HTTP POST to the login page
The –save-cookies and –load-cookies allow for cookie-based authentication tokens to persist between requests.
If the form of authentication being used is more complex then the answer is going to be quite different – so it would help to state which website you have in mind. Furthermore, many sites have APIs that you should use instead…
In general it would help if you could clarify the question a little — I find this bit ‘at the same time I want to automatically take the user id and the password also’ a bit confusing. If you want to do an interactive session in bash (i.e. getting the user to input username and password into the bash script) then you will find
very useful (eg. read -e -p “My prompt: ” varname; echo $varname).