간단한 java http client 가 있다. android도 지원하는 경량 java http client이다. 


OkHttp - http://square.github.io/okhttp



public static final MediaType JSON

= MediaType.parse("application/json; charset=utf-8");

OkHttpClient client = new OkHttpClient();

String post(String url, String json) throws IOException {

RequestBody body = RequestBody.create(JSON, json);

Request request = new Request.Builder()

.url(url)

.post(body)

.build();

Response response = client.newCall(request).execute();

return response.body().string();

}





Posted by '김용환'
,