2017-06-21 35 views
0

這裏是我的代碼從接入點我試圖輪詢來源:如何從java(路由器或AP)中的非安全網頁讀取數據?

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> 

我想訪問這個單位的網絡gui來獲取它的信號強度並將其存儲在一個文本文件中。我認爲問題在於,gui不受https標準的保護,並且需要更多的授權,但它可能只是因爲我開始時做了錯誤的過程。如果任何人都可以幫助我獲得頁面的完整源代碼或引導我正確執行我需要做的事情,那將不勝感激。

回答

0

標籤

<meta http-equiv='Refresh' content='0; URL=index.htm?mac_esn=0a003e40eb1e' /> 

意味着Web瀏覽器將刷新網址爲index.htm?mac_esn=0a003e40eb1e的第0頁秒鐘後,即重定向到該頁面。

您需要執行相同的操作,即解析該行並執行其他請求。

相關問題