给Parser设置代理
ConnectionManager cm = new ConnectionManager();
cm.setProxyHost("192.168.0.103");
cm.setProxyPort(3128);
/**设置请求头信息**/ String header_user_agent = Config.get().get("header_user_agent"); String header_referer = Config.get().get("header_referer"); Hashtable<String, String> properties = new Hashtable<String,String>(); properties.put("User-Agent",header_user_agent); if(header_referer!=null && header_referer.length()!=0) properties.put("Referer", header_referer); else properties.put("Referer", urlInfo.getReferer()); cm.setRequestProperties(properties); Parser.setConnectionManager(cm);
Parser parser = new Parser(url);