我正在尝试向 url 发出请求,你已经编写了以下代码,并且我在一个对象webApi
中有我的参数。NameValuePair
现在我不知道如何将这些参数添加到基本 uri 我必须通过连接字符串手动完成吗?或者有没有其他方法,请帮忙。
private static final String apiBaseUri="http://myapp.myweb.com/path?";
private boolean POST(List<NameValuePair>[] nameValuePairs){
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(apiBaseUri);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs[0]));
HttpResponse response = httpclient.execute(httppost);
String respond = response.getStatusLine().getReasonPhrase();
Log.d("MSG 3 > ",respond);
return true;
}