Java代码中访问链接提示java.io.IOException: Server returned HTTP response code: 403 for UR
程序员文章站
2022-07-08 11:06:01
...
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)");