package com.action;import java.io.BufferedReader;import java.io.InputStream;import java.io.InputStreamReader;import java.net.HttpURLConnection;import java.net.URL;import java.util.ArrayList;import java.util.List;import net.sf.json.JSONArray;import net.sf.json.JSONObject;public class test { /** * @Author liuchao email:542178387@qq.com * @data 2017-5-11 * @version 1.0.1 * @param args */ public static String get(String urlAll,String charset){ BufferedReader reader = null; String result = null; StringBuffer sbf = new StringBuffer(); String userAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36";//模拟浏览器 try { URL url = new URL(urlAll); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("GET"); connection.setReadTimeout(30000); connection.setConnectTimeout(30000); connection.setRequestProperty("User-agent",userAgent); connection.connect(); InputStream is = connection.getInputStream(); reader = new BufferedReader(new InputStreamReader( is, charset)); String strRead = null; while ((strRead = reader.readLine()) != null) { sbf.append(strRead); sbf.append("\r"); } reader.close(); result = sbf.toString(); } catch (Exception e) { e.printStackTrace(); } return result; } public static List