bash script to login to webpage bash script to login to webpage curl curl

bash script to login to webpage


Some things you're obviously doing wrong - your form looks like this:

<form onsubmit="return validate_form(this)" method="post" action="https://bb5.fsu.edu/cas/" id="login" AUTOCOMPLETE="off"><!-- etc -->  </form>

You need to submit your request to the "action" URL of the form, and you need to make it a POST request instead of a GET request to some other URL.


curl -c vh.cookie "http://campus.fsu.edu/webapps/login/bb_bb60/logincas.jsp?username=foor&password=bar" curl -b vh.cookie "http://campus.fsu.edu/webapps/login/login.result"

where http://campus.fsu.edu/webapps/login/login.result is the end url after user is authenticated

so initially authenticate then - call curl again and load in cookie to authenticated url


I managed to do this with python and mechanize. Should work for you too:

http://stockrt.github.com/p/handling-html-forms-with-python-mechanize-and-BeautifulSoup/

You can also download selenium plugin and export your loging-in scenario as python, ruby or java script. With some libraries downloaded you'll achieve the same.