我的银行有一个我想要自动登录的移动网站。 这是网页https://ib.absa.co.za/ib/AuthenticateW.do?icmpid=BAC00414。通过android webview自动登录网站问题
这是我的代码到目前为止。
browser = (WebView)findViewById(R.id.webView1);
browser.getSettings().setJavaScriptEnabled(true);
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("AccessAccount", "my_account_nr"));
nameValuePairs.add(new BasicNameValuePair("PIN", "my_pin"));
try {
browser.loadData(CustomHttpClient.executeHttpPost(BASE_URL, nameValuePairs), "text/html", "utf-8");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BASE_URL是顶部的链接。我从http://code.google.com/p/virtualwalks/source/browse/trunk/virtualwalks/project7/Android/CustomHttpClient.java?spec=svn177&r=177
这里得到了CustomHttpClient是网页标题:
申请网址:https://ib.absa.co.za/ib/AuthenticateW.do icmpid = BAC00414
请求方法:GET
状态代码:200 OK
请求Headersview源
接受:text/html的,应用/ XHTML + xml的,应用/ XML; Q = 0.9,/; Q = 0.8
接收字符集:ISO-8859-1,utf-8; Q = 0.7, *; q = 0.3
接受编码:gzip,紧缩,SDCH
接受语言:EN-US,EN; q = 0.8,自动对焦; q = 0.6
连接:保持活跃
主持人:ib.absa.co.za
Referer:http://www.absa.mobi/
User-Agent:Mozilla/5.0(Linux; U; Android 2.3.6; EN-US; Nexus S Build/GRK39F) AppleWebKit/533.1(KHTML,如Gecko)Version/4.0 Mobile Safari/533。1
查询字符串Parametersview URL编码
icmpid:BAC00414
响应Headersview源
缓存控制:无缓存,必须-重新验证
连接:保持活动
内容编码:gzip
内容语言:zh-CN
的Content-Type:text/html的;字符集= ISO-8859-1
日期:星期三,2012年10月10日7时57分50秒GMT
过期:孙,1970年7月12日2:00:00 GMT
保持活动:超时= 10,最大= 20
杂注:无缓存
的Set-Cookie:JSESSIONID = 0000CTls0Onsd_DJkBrN0FLy9eq:11l21e8a2;路径=/IB;域= absa.co.za;安全
传输编码:分块
有所不同:接受编码,用户代理
和HTML代码:
<html>
Absa手机银行服务
<body text="#000000" bgcolor="#FFFFFF">
<p align="left" style="text-align:left;" class="pgHeadTop"><img src="/ib/images/wap/menu/absa_98x27.gif" alt="Logo" border="0"> <p align="left" style="text-align:left;" class="pgHeadBottom">Logon </p>
<form action="https://vs1.absa.co.za/ib/AuthenticateW.do;jsessionid=0000CTls0Onsd_DJkBrN0FLy9eq:11l21e8a2" method="post" autocomplete="OFF"><input type="hidden" name="_channelIdentifier_" value="W">
<p align="left" style="text-align:left;">
<p align="left" style="text-align:left;" class="tooltip">Enter your access account number</p>
<input type="text" name="AccessAccount" value="" maxlength="16" size ="16" istyle="4">
</p>
<p align="left" style="text-align:left;">
<p align="left" style="text-align:left;" class="tooltip">Enter your PIN</p>
<input type="password" name="PIN" value="" maxlength="5" size ="5" istyle="4">
</p>
<p align="left" style="text-align:left;">
<p align="left" style="text-align:left;" class="tooltip">Enter your user number</p>
<input type="text" name="user" value="1" maxlength="4" size ="5" istyle="4">
</p>
<p align="left" style="text-align:left;">
<p align="left" style="text-align:left;" class="heading">It is your responsibility to ensure the secrecy of your PIN number.</p>
</p>
<p align="left" style="text-align:left;">
<input type="submit" name="button_processPIN" value="Next >" /><input type="hidden" name="processPIN_params" value="controller=com.sirius.apps.ib.view.wap.user.AuthenticateCntrl&state=processPIN"/><input type="hidden" name="processPIN_encoding" value="u"/><input type="hidden" name="cmd" value="button"/>
</p>
<input type="hidden" name="AUTH_RND" value="a2f7ea6e">
<input type="hidden" name="JAVASCRIPT" value="Y">
<input type="hidden" name="LOGON" value="1">
</form>
<p align="left" style="text-align:left;" class="pageFooter"><a href="https://ib.absa.co.za/ib/RegisterW.do;jsessionid=0000CTls0Onsd_DJkBrN0FLy9eq:11l21e8a2?_Uid_=1&_channelIdentifier_=W&_language_=en" style="color:#FFFFFF;">Register</a> | <a href="https://ib.absa.co.za/ib/ContactUsW.do;jsessionid=0000CTls0Onsd_DJkBrN0FLy9eq:11l21e8a2?_Uid_=1&_channelIdentifier_=W&_language_=en" style="color:#FFFFFF;">Contact</a> | </p><p align="right" style="text-align:right;" class="body"><img src="/ib/images/wap/menu/barclays_84x25.gif" alt="Barclays" border="0"></p>
</body>
如果我运行该程序,它只是加载登录页面。
只是希望有人能够对此有所了解,如果可能的话,或者如果我的代码有缺陷/缺乏/愚蠢。
感谢您的答复,但这不是它。通过将BASE_URL更改为https://ib.absa.co.za/ib/AuthenticateW.do;jsessionid=0000jZVR5d-ZE4uCMrzIGIW_euZ:11I9gc802?_channelIdentifier_=W&_language_=en,但现在它只是加载登录页面并忽略我的自动登录尝试。任何想法,将不胜感激。 – LeftOfHere