Friday, September 27, 2013

Log into website using java

Log into website using java

I'm trying to use java to log into a website, but I'm having trouble doing
so, what am I missing?
Sending 'POST' request to URL : https://example.com/auth/
Post parameters : return_to=%2F&username=a&password=1&=Sign+In
I then called postParams on the HttpUrlConnectionExample object with url
and paragms, but I can't seem to log in, I get redirected back to the
login page. So I tried using only the paragrams: username=a&password=1 but
it still redirected me back to the login page. Any help to help me log in?
My credentials are 100% correct. Below is the form tag from the
https://example.com/auth/ page
<form id="loginForm" method="post" action="./do_login" name="loginForm">
<input type="hidden" name="return_to" value="/"/>
<div class="controlContainer">
<label for="username">User ID</label>
<input id="userid" class="field" type="text" value=""
maxlength="128" spellcheck="false" name="username"
autocomplete="off"
placeholder="User ID" tabindex="1"/>
<label for="password">Password</label>
<input id="password" class="field" type="password" value=""
maxlength="128" spellcheck="false" name="password"
placeholder="Password" autocomplete="off"tabindex="2"/>
<input id="submitButton" class="button" type="submit"
value="Sign In" tabindex="3"/>
</div>
</form>

No comments:

Post a Comment