OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("http://www.netkiller.cn") .build(); Response response = client.newCall(request).execute(); if (!response.isSuccessful()) { throw new IOException("伺服器端錯誤: " + response); } Headers responseHeaders = response.headers(); for (int i = 0; i < responseHeaders.size(); i++) { System.out.println(responseHeaders.name(i) + ": " + responseHeaders.value(i)); } System.out.println(response.body().string());