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