java.io.IOException: Server returned HTTP response code: 403 for URL: http://query.sse.com.cn/infodi

最近在做网络爬虫,然后出现了这种403错误,有些人解释设置代理就可以解决问题,其实并不全面,因为不同网站,检验的方式不同,大致分为三种方式cookie,refer,以及user-agent,出现403错误时可以尝试设置这三个属性就能解决。
第一种:httpConn.setRequestProperty("cookie", "dsdsd");
第二种: httpConn.setRequestProperty("referer", "http://www.sse.com.cn/disclosure/diclosure/public/");
第三种 httpConn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); 

你可能感兴趣的:(java.io.IOException: Server returned HTTP response code: 403 for URL: http://query.sse.com.cn/infodi)