|
@@ -99,6 +99,15 @@ public class HttpClientUtil {
|
|
|
return String.valueOf(response.code());
|
|
|
}
|
|
|
|
|
|
+ public static String gets(String url) throws Exception {
|
|
|
+ Request request = new Request.Builder()
|
|
|
+ .url(url)
|
|
|
+ .get()
|
|
|
+ .build();
|
|
|
+ Response response = client.newCall(request).execute();
|
|
|
+ return response.body() != null ? response.body().string() : null;
|
|
|
+ }
|
|
|
+
|
|
|
public static InputStream download(String url) throws Exception {
|
|
|
Request request = new Request.Builder().url(url).build();
|
|
|
ResponseBody body = client.newCall(request).execute().body();
|