Loopj AsynHttpClient
我正在尝试连接到ASP.NET WebApp。
OnSuccess回调,我想阅读网页并从网页上获取文本和数据。我怎样才能得到它或如何将其解析为JSON或XML?
我通过将params发布到登录页面成功连接到该站点。现在我想读取重定向的网页。
以及如何保存cookie或缓存,以便在运行Android APP时自动登录。
client.get("https://uogis.uog.edu.pk/LandingPage.aspx", new AsyncHttpResponseHandler(){
@Override
public void onFailure(int arg0, Header[] arg1,
byte[] arg2, Throwable arg3) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(int arg0, Header[] arg1,
byte[] arg2) {
// TODO Auto-generated method stub
mTextView.setText("In Landing Page now");
}
@Override
public void onFinish() {
params.put("TextBox1","Home");
client.get("https://uogis.uog.edu.pk/ControlPanel.aspx",new AsyncHttpResponseHandler(){
@Override
public void onFailure(int arg0,
Header[] arg1, byte[] arg2,
Throwable arg3) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(int arg0,
Header[] arg1, byte[] arg2) {
// TODO Auto-generated method stub
mTextView.setText("In Control Panel\n"+ "ResponseCode "+arg0+ "\n" );
}});
}
});