我試圖下載如下頁面:http://structureddata.wikispaces.com/Test正在下載網頁。 OK用wget的,無法用java
wget的沒有任何選項失敗:
wget "http://structureddata.wikispaces.com/Test"
(...) connect to session.wikispaces.com insecurely, use `--no-check-certificate'
與--no檢查證書,它的工作原理現在
wget --no-check-certificate "http://structureddata.wikispaces.com/Test"
grep Hello Test
Hello World
,我想下載的Java相同的URL,但下面的程序:
import java.net.*;
import java.io.*;
public class Test
{
public static void main(String args[])
{
int c;
try
{
InputStream in=new URL("http://structureddata.wikispaces.com/Test").openStream();
while((c=in.read())!=-1) System.out.print((char)c);
in.close();
}
catch(Throwable err)
{
err.printStackTrace();
}
}
}
返回任何
我應該怎麼辦與Java下載頁?
非常感謝,
Ppierre
有一些奇怪的現象:錯誤表明您使用的https與給定的URL不一致。我無法從wget重現消息。是否有涉及代理服務器? – 2010-09-03 18:03:33