try {
ArrayList params = new ArrayList();
params.add(new BasicNameValuePair(key, value);
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
post.setEntity(new UrlEncodedFormEntity(params));
HttpResponse response = client.execute(post);
ByteArrayOutputStream outstream = new ByteArrayOutputStream();
response.getEntity().writeTo(outstream);
Log.d(outstream.toString());
} catch (UnsupportedEncodingException e) {
Log.e(TAG, e.getMessage());
} catch (ClientProtocolException e) {
Log.e(TAG, e.getMessage());
} catch (IOException e) {
Log.e(TAG, e.getMessage());
}
今回もこれだけです。
次回はもう少し解説加えますが、
これで、HTTPのPOSTが出来ます。
よろしくお願いします。
0 件のコメント:
コメントを投稿