ITeye博客

Java代码中访问链接提示java.io.IOException: Server returned HTTP response code: 403 for UR

caichenglong · 2018-08-07 10:05 · 其他 · Web前端 · Markdown

URL realURL = null;
realURL = new URL(url);
connection = realURL.openConnection();
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64)
 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36)");

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。