欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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)");