我已經在我的程序編寫下面的代碼獲得403試圖用的ImageIO
url = new URL("http://stackoverflow.com/users/flair/3626698.png?theme=dark");
ImageIO.read(url);
我收到以下錯誤
Exception in thread "main" javax.imageio.IIOException: Can't get input stream from URL!
at javax.imageio.ImageIO.read(ImageIO.java:1395)
at javaapplication1.JavaApplication1.main(JavaApplication1.java:25)
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://stackoverflow.com/users/flair/3626698.png?theme=dark
....
我可以使用wget
的圖像時,由在瀏覽器上寫網址等...
我不明白爲什麼我在這裏得到403。
來看一下,http://stackoverflow.com/questions/3023243/unable-to-acquire-image-through-imageio-readurl-because-of- connection-timed-ou可能會幫你 – Zia