如何从java(路由器或AP)中的非安全网页读取数据?
以下是我从尝试轮询的访问点获取源代码的代码:如何从java(路由器或AP)中的非安全网页读取数据?,java,html,httprequest,Java,Html,Httprequest,以下是我从尝试轮询的访问点获取源代码的代码: import java.net.*; import java.io.*; public class URLReader { public static void main(String[] args) throws Exception { URL oracle = new URL("http://x.x.x.x"); //Some valid IP BufferedReader in = new Buffe
import java.net.*;
import java.io.*;
public class URLReader {
public static void main(String[] args) throws Exception {
URL oracle = new URL("http://x.x.x.x"); //Some valid IP
BufferedReader in = new BufferedReader(new InputStreamReader(oracle.openStream()));
String inputLine;
System.out.println("In");
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
以下是我得到的而不是所需的源代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/x
html1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="_canopy.css" media="screen" />
<link rel="stylesheet" type="text/css" href="_canopypda.css" media="handheld" />
<meta http-equiv='Refresh' content='0; URL=index.htm?mac_esn=0a003e40eb1e' />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name='viewport' content='width=device-width,initial-scale=1,user-scalable=
no' />
<title>Welcome to Canopy</title>
<script language="javascript" type="text/javascript">
<!--- Hide script from old browsers
function CheckForJS()
{
var d = new Date();
var t = d.getTime();
document.cookie = "JS=true; expires=" + (t+600);
}
// end hiding from old browsers -->
</script>
</head>
<body onload="CheckForJS();">
<p>
Press <a href="http:index.htm?mac_esn=0a003e40eb1e">Here</a> to Continue.
</p>
</body>
</html>
欢迎来到华盖
按继续。
我正在尝试访问该单元的web gui,以获取其信号强度并将其存储在文本文件中。我有点认为问题在于gui不受https标准的保护,需要更多的授权,但这可能只是因为我一开始就做得不对。如果有人能帮我找到页面的完整来源,或者指导我正确的方向,我将不胜感激。标签
<meta http-equiv='Refresh' content='0; URL=index.htm?mac_esn=0a003e40eb1e' />
表示web浏览器将在0秒后使用urlindex.htm?mac_esn=0a003e40eb1e
刷新页面,即重定向到该页面
您需要执行相同的操作,即解析该行并执行另一个请求