java.io.IOException: Server returned HTTP response code: 403 for URL: http://的解决办法
来源:互联网 发布:kali linux arp欺骗 编辑:程序博客网 时间:2024/05/16 09:27
java.io.IOException: Server returned HTTP response code: 403 for URL: http://blog.csdn.net/w1242245
今天在爬虫扒取网页的时候,其中有一个网页我发现不能像往常一样将内容扒下,增加以下内容解决:
原:
private Parser parser;
public TestUrl(String htmlAddress) throws ParserException, IOException {
parser = new Parser(htmlAddress);
parser.setEncoding("gb2312");
}
修改以后:
private Parser parser;
public TestUrl(String htmlAddress) throws ParserException, IOException {
URL url = new URL(htmlAddress);
HttpURLConnection connection = (HttpURLConnection) url.
openConnection();
connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
parser = new Parser(connection);
parser.setEncoding("gb2312");
}
成功解决!
- java.io.IOException: Server returned HTTP response code: 403 for URL: http://的解决办法
- java.io.IOException: Server returned HTTP response code: 500 for URL解决办法
- java.io.IOException: Server returned HTTP response code: 403 for URL: http://
- java.io.IOException: Server returned HTTP response code: 403 for URL: http://
- 用户代理及 java.io.IOException: Server returned HTTP response code: 403 for URL
- java.io.IOException: Server returned HTTP response code: 403 for URL
- 用户代理异常:java.io.IOException: Server returned HTTP response code: 403 for URL
- java.io.IOException: Server returned HTTP response code: 505 for URL: http://localhost:8080/fish/add
- java.io.IOException: Server returned HTTP response code: 403 for URL: http://query.sse.com.cn/infodi
- java.io.IOException: Server returned HTTP response code: 500 for URL
- java.io.IOException: Server returned HTTP response code: 500 for URL
- java.io.IOException: Server returned HTTP response code: 400 for URL解决方法
- java.io.IOException: Server returned HTTP response code: 505 for URL: 问题
- java.io.ioexception: server returned http response code: 500 for url:
- [报错总结]java.io.IOException: Server returned HTTP response code: 500 for URL:
- java.io.IOException: Server returned HTTP response code: 405 for URL: *********处理方法
- Exception in thread "main" java.io.IOException: Server returned HTTP response code: 400 for URL解决方案
- java.io.IOException: Server returned HTTP response code: 415 for URL:xxxxxx
- Oracle连接出现没有监听程序
- 登陆email
- DLL头文件与源文件的基本编写格式
- (opencv)Android人脸识别
- IT人员必须掌握的10项软技能
- java.io.IOException: Server returned HTTP response code: 403 for URL: http://的解决办法
- Ubuntu编译内核
- navicat for mysql只导出数据表结构
- iOS开发 mac证书无法展开
- JAVA注解
- win7下 无法创建AVD
- 112041 Rac CTSS service start failed during Gi install on AIX 7.1
- LeetCode Maximum Depth of Binary Tree
- JS学习笔记