嗨,我想知道当输入错误的电子邮件或密码时,是否有人可以帮助我使用来自 facebook 的 jsoup 获取 URL。我不知道如何获取网址,但我可以获取文本。
这是我的代码:
package com.sigustgebran.appsl;
import android.os.Bundle;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class MainAct extends Activity {
TextView display;
String anerror = "error";
// facebook url
static final String FACE_URL = "https://www.facebook.com/";
@Override
protected void onCreate(Bundle savedInstanceState) {
// set layout view
super.onCreate(savedInstanceState);
setContentView(R.layout.act_main);
display = (TextView) findViewById(R.id.tvDisplay);
// process
try {
display.setText(logfail());
} catch (Exception ex) {
display.setText(anerror);
}
}
protected String logfail() throws Exception {
String result = "";
Document document = Jsoup.connect(FACE_URL)
.data("lsd", "AVrzRTqK")
.data("email", "xxxxx")
.data("pass", "xxxxx")
.data("u_0_b", "Logga in")
.data("persistent", "1")
.data("default_persistent", "0")
.data("timezone", "-120")
.data("lgnrnd", "145445_r4qy")
.data("lgnjs", "1369864484")
.data("locale", "sv_SE")
.post();
result = document.text();
// return
return result;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
谢谢!!