I want to crawl my authenticated data from university homepage and there are no API calls.
Therefore, I have to send POST data like id and password to server, but I cannot login without clicking login button.
Below is my code of university homepage.
<form action="./_login.php" method="post" autocomplete = "off" onSubmit="return comp()" name="login" >
<!--<form action="https://hisnet.handong.edu/login/_login.php" method="post" autocomplete = "off" onSubmit="return comp()" name="login" >-->
<!-- E-mail¿¡ ÀÖ´Â ¸µÅ©¸¦ Ŭ¸¯ÇÏ¿© À̵¿ÇÏ´Â °æ¿ì, ÀúÀåµÇ´Â °ª 3°¡Áö -->
<input type =hidden name ="part" value ="">
<input type =hidden name ="f_name" value ="">
<input type =hidden name ="agree" value =""> <!-- 2013.10.04 ÃÊ°ú±Ù¹« À̸ÞÀÏ¿¡¼ °áÁ¦Ã¢À¸·Î ¹Ù·Î À̵¿ÇϱâÀ§ÇØ Ãß°¡ (±èÀÎŹ) -->
<table border="0" cellpadding="0" cellspacing="0" width="285">
<tr>
<td><img src="/2012_images/intro/logbox1.gif" /></td>
</tr>
<tr>
<td height="23" style="text-align:center; background-image:url(/2012_images/intro/logbox2.gif)">
<input type="radio" name="Language" value="Korean" checked>
<a href='#' onkeypress='checkKorean();'><font style='font-size:10pt;'>ÇѱÛ</font></a>
<input type="radio" name="Language" value="English">
<a href='#' onkeypress='checkEnglish();'><font style='font-size:10pt;'>English</font></a>
</td>
</tr>
<tr>
<td style="text-align:center; background-image:url(/2012_images/intro/logbox2.gif)">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="/2012_images/intro/txt_id.gif" width="61" height="18" /></td>
<td><span style="">
<input type="text" style="color:#000000; height: 16px; width:138px;ime-mode:inactive" name="id" autocomplete="off" tabindex="1" placeholder="¾ÆÀ̵𸦠ÀÔ·ÂÇϽʽÿÀ." value=""/>
</span></td>
</tr>
<tr>
<td height="6" colspan="2"></td>
</tr>
<tr>
<td><img src="/2012_images/intro/txt_pwd.gif" width="61" height="18" /></td>
<td><input type="password" style="color:#000000; height: 16px; width:138px;ime-mode:inactive" name="password" autocomplete="off" tabindex="1" placeholder="Æнº¿öµå¸¦ ÀÔ·ÂÇϽʽÿÀ."></td>
</tr>
</table>
</td>
<td style="padding-left:8px;"><input type="image" src="/2012_images/intro/btn_login.gif" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="/2012_images/intro/logbox_line.gif" /></td>
</tr>
<tr>
<td style="text-align:center; background-image:url(/2012_images/intro/logbox2.gif); height:18px;">
<input type="checkbox" id="saveid" name="saveid" value="Y" /> ¾ÆÀ̵ðÀúÀå <a onclick="UserLoginPopUp()" style="cursor:pointer"><font color="#FF0000"><!--<b>* HISNet ·Î±×ÀÎÀÌ ¾ÈµÉ °æ¿ì</b>--></font></a>
</td>
</tr>
<tr>
<td><img src="/2012_images/intro/logbox3.gif" /></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><img src="/2012_images/intro/line_txt1_1.gif" border=0/><a href="/registration/regist_step1.php"><img src="/2012_images/intro/line_txt1_2.gif" border=0/></a></td>
</tr>
<tr>
<td><img src="/2012_images/intro/line_txt2_1.gif" border=0/><a href="javascript:findID();"><img src="/2012_images/intro/line_txt2_2.gif" border=0/></a></td>
</tr>
<tr>
<td><img src="/2012_images/intro/line_txt3_1.gif" border=0/><a href="javascript:findPW();"><img src="/2012_images/intro/line_txt3_2.gif" border=0/></a></td>
</tr>
</table>
</form>
I implemented like this.
main() async {
http.post('http://hisnet.handong.edu/login/login.php',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: {'id':'myID','password':'myPassword'})
.then((response){
print('Response status: ${response.statusCode}');
print('Response body: ${response.body}');
});
}
However, this implementation only fills the form and not click the login button. In this situation, I wanna send my data to server. How can I do that?
I believe here is how you grok the info.
Step 1, navigate to login page. Step 2, open your browser debugging tools and select network
Step 3, fail or succeed the login to grab the post info
With all of that information, create your login
I honestly do no understand what all these fields mean or have a successful attempt, so I cannot verify regardless whether I am supposed to send an int or string. The worst case scenario, you need to use a webbrowser