Hello list,
I'm trying to automate my internet login which is based on a web form. I
have already checked few tutorial/posts on form submission by curl. I
have tried various combinations too but nothing worked in my case.
When I inspect the form I get following for username/password text box
and submit button
````````
<input type="text" name="Username" size="20">
<input type="password" name="Password" size="20">
<input type="submit" class="btn_cp" value="Login" onclick="return
validateForm()">
```````
when I check by curl I get below
~~~~
# curl <link>/Login.jsp | grep Username
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:--
--:--:-- 0function newCookie(Username,value,days) {
document.cookie = Username+"="+value+expires+"; path=/"; }
function readCookie(Username) {
var nameSG = Username + "=";
function eraseCookie(Username) {
newCookie(Username,"",1); }
newCookie('theName', document.login.Username.value); // add a
new cookie as shown at left for every
document.login.Username.value = ''; // add a line for every field
document.login.Username.value = readCookie("theName");
document.login.Username.value = trim(document.login.Username.value);
if(document.login.Username.value.length==0){
document.login.Username.focus();
var uname = "?"+document.login.Username.value+"+/@";
<td width="35%" height="25" align="center"
valign="middle" nowrap="nowrap"><strong
style="color:#FFFFFF">Username </strong></td>
<td width="48%" align="left"><input type="text"
name="Username" size="20" ></td>
~~~~
# curl <link>/Login.jsp | grep Pass
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:03
--:--:-- 0 newCookie('theEmail',
document.login.Password.value); // field you wish to have the script
remember
document.login.Password.value = ''; }
document.login.Password.value = readCookie("theEmail");
if(document.login.Password.value.length==0){
alert("Password is required.");
document.login.Password.focus();
var pwd = "?"+document.login.Password.value+"+/@";
document.login.LoginPassword.value=encodeURIComponent(pwd);
<td height="26" align="center"
valign="middle" nowrap="nowrap"><strong
style="color:#FFFFFF">Password </strong></td>
<td align="left"><input type="password"
name="Password" size="20" ></td>
100 12004 0 12004 0 0 3405 0 --:--:-- 0:00:03
--:--:-- 3405
<td align="left"
valign="middle"><input type="hidden" name="LoginPassword" /></td>
^^^^^
Hence I construct a curl command like
curl -sd "Username=<username>&Password=<password>&submit=Login"
http://<link>/Login.jsp
which is not working unfortunately. Have I missed anything ?
Your clue will be helpful.
Regards,
Bob