我想從鏈接得到JSON信息: http://android.forum-example.org/?a=1 & B = 2 & C = 3HttpPost URI是不完整的
但Log.v告訴我後request.setEntity(new UrlEncodedFormEntity(qparams)); 我的URI是:http://android.forum-example.org/?
我的錯誤在哪裏?
代碼:
try {
HttpClient httpClient = new DefaultHttpClient();
HttpPost request = new HttpPost("http://android.forum-example.org/?");
List<NameValuePair> qparams = new ArrayList<NameValuePair>(3);
qparams.add(new BasicNameValuePair("a", "1"));
qparams.add(new BasicNameValuePair("b", "2"));
qparams.add(new BasicNameValuePair("c", "3"));
request.setEntity(new UrlEncodedFormEntity(qparams));
Log.v("URI:", request.getURI().toString());
HttpResponse response = httpClient.execute(request);
} catch (IOException e) { e.printStackTrace(); }
11-06 17:21:03.758:V/URI:(13235):http://android.forum-example.org/? – Sviatoslav