Android Java自动登录网站

时间:2014-01-05 00:15:37

标签: java android

这是我的第一个Android应用程序。 我的背景是C#。 我一直试图在这个网站上自动提交网络表单: https://ppcplus.121fcu.org/Mobile/Features/Auth/MFA/MFALogin.aspx

我可以加载页面并在TextView中查看html但不提交表单。 最终,这个项目旨在成为一个完全不干涉的,0步骤,主屏幕的小部件,它将显示我从银行账户,paypal等我的总余额。我搜索和搜索尝试各种不同的变化,没有运气。在Firefox中我可以填写文本框,但仍然无法获得实际提交的表单。任何帮助将不胜感激。

public static void connectToSite(){

    HttpClient httpClient = new DefaultHttpClient();


    try{            
        HttpPost httppost = new HttpPost("https://ppcplus.121fcu.org/Mobile/Features/Auth/MFA/MFALogin.aspx");
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
        nameValuePairs.add(new BasicNameValuePair("UserIDValue", "12345"));
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse response = httpClient.execute(httppost);

        HttpEntity entity = response.getEntity();
        responseString = EntityUtils.toString(entity);
    }
    catch (ClientProtocolException e) {
        e.printStackTrace();
    } 
    catch (IOException e) {
        e.printStackTrace();
    }
}

0 个答案:

没有答案