2017-06-21 1 views
0

は私がポーリングしようとしていたアクセスポイントからソースを取得するために私のコードです:ここではjava(ルーターまたはAP)のNONセキュアWebページからデータを読み取る方法は?ここ

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標準で保護されておらず、より多くの認証が必要だと思っていますが、まずは間違った処理をしている可能性があります。誰かが私がページの完全なソースを手に入れるのを手伝ったり、私がやるべきことの正しい方向に私を助けることができれば、それは非常に高く評価されます。

答えて

0

タグ

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

Webブラウザは、すなわちそのページにリダイレクトし、0秒後にURL index.htm?mac_esn=0a003e40eb1eでページを更新することを意味します。

同じことを行う必要があります。つまり、その行を解析して別のリクエストを行う必要があります。

関連する問題