String url = "http://zhuanlan.zhihu.com/api/columns/oh-hard/posts/20332126";
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection) new URL(url).openConnection();
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko");
conn.setRequestProperty("contentType ", "zh-CN");
conn.setRequestProperty("Accept-Encoding", "gzip,deflate");
conn.setRequestProperty("Accept-Language ", "zh-CN,zh;q=0.8");
InputStream inputStream = conn.getInputStream();
String result = "";
InputStream urlStream = new GZIPInputStream(inputStream);
BufferedReader in = new BufferedReader(new InputStreamReader(urlStream,"utf-8"));
String line = "";
while ((line = in.readLine()) != null) {
result += line;
}
System.out.println(result);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}