0
在我的Android应用程序中,我使用JSOUP来POST数据来模拟登录窗体的提交动作(自动登录到WISPR热点) This是原始响应,我从POST得到:Android上的Jsoup:用Javascript重定向(window.location)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>connexion</title>
<script type="text/javascript">
window.location = "http://192.168.2.1:3990/[email protected]&response=e30ee504ba06fa77502f1b9e8ccbaf8d&uamip=192.168.2.1&userurl=http%3A%2F%2Fwww.sfr.fr%3Bneuf%3Bfr%3B3%3Bhttp%3A%2F%2Fwww.sfr.fr%3B";
</script>
</head>
<body>
</body>
</html>
我与我使用Firebug登录成功后,它是完全一样的,当然除了在“回应”中与桌面浏览器中得到的反应进行了比较PARAM。
正如你所看到的,在这里,它使用Javascript进行重定向。 作为JSOUP仅3XX如下重定向,我试图从响应解析给定位置的URL,并在其上
Document doc = Jsoup.connect(parsedRedirectURL).cookies(cookies).get();
执行之后的GET请求,但我发现了一个
Java.net.SocketTimeoutException: failed to connect to /192.168.2.1 (port 3390) after 3000ms
什么我错过了吗?
是的,这是第二次搞砸了端口号,但我修好了,现在它工作!非常感谢您注意! – Christine