alphine Posted July 16, 2009 Share Posted July 16, 2009 Hi, I am trying to login to a JSP page with cURL. I want to use PHP to pass predefined username/password to the JSP page and login. I am getting stuck at it, because there are some Javascripts. Here is the source of the JSP i am trying to login with cURL. Any help appriciated. ----------------- <html> <head> <title>Welcome to EVC</title> <link href="/insms/dealer/en/login/websmap.css" rel="stylesheet" type="text/css"> <script src="/insms/dealer/js/lengthConfig.js" type="text/javascript"></script> <script language="JavaScript"> self.moveTo(0,0) self.resizeTo(screen.availWidth,screen.availHeight) </script> </head> <body background="/insms/dealer/en/login/images_en/images/js_bg.gif" leftmargin="0" topmargin="0"> <SCRIPT FOR=window EVENT=onload LANGUAGE="javascript"> document.mainform.loginuser.focus(); </SCRIPT> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%"><table width="100%" height="150" border="0" cellpadding="0" cellspacing="0"> <tr> <td> </td> </tr> </table></td> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="42" valign="top"><img src="/insms/dealer/en/login/images_en/images/js_03.gif" width="42" height="85"></td> <td valign="top"><table width="100%" height="85" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="179" valign="top" background="/insms/dealer/en/login/images_en/images/js_04.gif"><img src="/insms/dealer/en/login/images_en/logo.gif" width="157" height="54"></td> <td align="right" valign="middle" background="/insms/dealer/en/login/images_en/images/js_06.gif"> </td> </tr> </table></td> <td width="41" valign="top"><img src="/insms/dealer/en/login/images_en/images/js_08.gif" width="41" height="85"></td> </tr> <tr> <td valign="top" background="/insms/dealer/en/login/images_en/images/js_13.gif"> </td> <td valign="top" bgcolor="#B7D4ED"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="tab05"> <tr valign="top"> <td align="center" valign="top" bgcolor="#B7D4ED"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="/insms/dealer/en/login/images_en/aim2.gif" width="200" height="31"></td> </tr> </table> <form name=mainform action="/insms/dealer/en/loginin.do" autocomplete=off method=post onsubmit="return checkvalue()&&checkTimes();"> <table width="95%" border="0" cellpadding="5" cellspacing="0" class="zi1"> <tr> <td width="38%" height="29" align="right" class="zi01">MSISDN:</td> <td width="62%" valign="bottom"> <script>document.write("<input name='loginuser' type='text' class='input' size='17' onkeypress='javascript:return (event.keyCode==13)||(event.keyCode>=48&&event.keyCode<=57);' maxlength='"+hp_maxlength+"'>");</script> </td> </tr> <tr> <td height="29" align="right" class="zi01">PIN:</td> <td valign="bottom" > <input name="loginpwd" type="password" class="input" size="17" maxlength="8"> </td> </tr> </table> <table width="60" border="0" align="center" cellpadding="12" cellspacing="0"> <tr> <td valign="bottom"><input type=image src="/insms/dealer/en/login/images_en/DL_24.gif" width="67" height="23" border="0"></a></td> <td valign="bottom"><input type=image src="/insms/dealer/en/login/images_en/DL_26.gif" width="67" height="23" border="0" onclick="mainform.reset();return false;"></a></td> </tr> </table> </form> </td> </tr> </table></td> <td valign="top" background="/insms/dealer/en/login/images_en/images/js_16.gif"> </td> </tr> <tr> <td valign="top"><img src="/insms/dealer/en/login/images_en/images/js_18.gif" width="42" height="44"></td> <td valign="top" background="/insms/dealer/en/login/images_en/images/js_20.gif"> </td> <td valign="top"><img src="/insms/dealer/en/login/images_en/images/js_22.gif" width="41" height="44"></td> </tr> </table></td> <td width="25%"><table width="100%" height="150" border="0" cellpadding="0" cellspacing="0"> <tr> <td> </td> </tr> </table></td> </tr> </table> </td> </tr> </table> <script language=javascript> mainform.loginuser.title= " "+MSISDNPrompt+" " ; function checkvalue() { //使用正则表达式校验,输入的必须1-13位是数字 var regex_hpno = "^(0|[0-9][0-9]{"+(hp_minlength-1)+","+(hp_maxlength-1)+"})$"; var regex_pwd = "^(0|[0-9][0-9]{3,7})$"; var pattern_hpno = new RegExp(regex_hpno); var pattern_pwd = new RegExp(regex_pwd); if (mainform.loginuser.value == null || mainform.loginuser.value == "") { alert("MSISDN cannot be null"); mainform.loginuser.focus(); return false; } if(!pattern_hpno.exec(mainform.loginuser.value)) { if(hp_minlength == hp_maxlength) { alert("MSISDN: Please enter a numerical string of "+hp_minlength+" digits"); } else { alert("MSISDN: Please enter a numerical string of "+hp_minlength+" to "+hp_maxlength+" digits"); } mainform.loginuser.focus(); return false; } if (mainform.loginuser.value.length< hp_minlength || mainform.loginuser.value.length > hp_maxlength) { if(hp_minlength == hp_maxlength) { alert("MSISDN: Please enter a numerical string of "+hp_minlength+" digits"); } else { alert("MSISDN: Please enter a numerical string of "+hp_minlength+" to "+hp_maxlength+" digits"); } mainform.loginuser.focus(); return false; } if (mainform.loginpwd.value == null || mainform.loginpwd.value == "") { alert("The PIN cannot be null"); mainform.loginpwd.focus(); return false; } if (mainform.loginpwd.value.length<4 || mainform.loginpwd.value.length > { alert("PIN: Please enter a numerical string of 4 to 8 digits"); mainform.loginpwd.focus(); return false; } if(!pattern_pwd.exec(mainform.loginpwd.value)) { alert("PIN: Please enter a numerical string of 4 to 8 digits"); mainform.focus(); return false; } return true; } var change = "0"; function checkTimes(){ if ( change=="0" ) { change="1"; return true; } else { alert("System is in processing, please wait"); return false ; } } </script> </body> </html> ----------- Link to comment https://forums.phpfreaks.com/topic/166166-help-with-curl-loggin-into-a-jsp-page/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.