我正在尝试连接到pastebin并登录。当我运行它时,HTML不会显示我已经登录并且我的配置文件ID在脚本中的任何位置。
Response loginResponse;
Document cur = null;
Map<String, String> loginCookies;
loginResponse = Jsoup.connect("http://www.pastebin.com/login.php")
.data("user_name", name)
.data("user_password", pwrd)
.data("submit", "Login")
.method(Method.POST)
.execute();
if (loginResponse != null)
{
loginCookies = loginResponse.cookies();
try
{
cur = Jsoup.connect("http://www.pastebin.com")
.cookies(loginCookies).get();
} catch (Exception e) {
e.printStackTrace();
}
for (Map.Entry<String, String> entry : loginCookies.entrySet())
{
System.out.println(entry.getKey() + "/" + entry.getValue());
}
String s = cur.body().html();
System.out.println(cur.body().html());
System.out.println(cur.body().html().contains("Arhowk"));
}我相信所有的数据字段都是正确的,php显示正在使用的POST方法,应该是好的。我对此相当陌生,我看到了很多有答案的页面,但我没有看到任何解决这个问题的方法。
发布于 2014-01-31 22:02:24
试着像浏览器一样这样做;)
https://stackoverflow.com/questions/21490138
复制相似问题