| | |
| | | |
| | | response = httpclient.execute(get); |
| | | |
| | | System.out.println(response.getStatusLine()); |
| | | |
| | | if (200 == response.getStatusLine().getStatusCode()) { |
| | | HttpEntity entity = response.getEntity(); |
| | |
| | | |
| | | response = httpclient.execute(post); |
| | | |
| | | System.out.println(response.getStatusLine()); |
| | | |
| | | if (200 == response.getStatusLine().getStatusCode()) { |
| | | HttpEntity entity = response.getEntity(); |
| | | resultString = EntityUtils.toString(entity, "utf-8"); |
| | |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("scope", "project"); |
| | | params.put("q", "数据库"); |
| | | // |
| | | // System.out.println(doGet("http://www.baidu.com/s",params)); |
| | | |
| | | /** |
| | | * 有一部分网站,禁止爬虫技术访问网站。 |
| | |
| | | param.append(entry.getKey()); |
| | | param.append("="); |
| | | param.append(entry.getValue()); |
| | | // System.out.println(entry.getKey()+":"+entry.getValue()); |
| | | } |
| | | // System.out.println("param:"+param.toString()); |
| | | out.write(param.toString()); |
| | | } |
| | | // flush输出流的缓冲 |