我必须在类似于这样的 url 中发送数据:
http://webservices.fecth.es/school/message/sendmessage/id/myStringId/destination/myStringDestination/msg/myMessage _ _ _ _ _ _ _ _ _ _ _
我在字符串中有必要的数据,但不是通过 post 方法发送,我已经测试了这段代码但不起作用:
String postURL = "http://webservices.fecth.es/school/message/sendmessage/";
HttpPost post = new HttpPost(postURL);
List<NameValuePair> param = new ArrayList<NameValuePair>();
param.add(new BasicNameValuePair("id", myId));
param.add(new BasicNameValuePair("destination", myStringDestination));
param.add(new BasicNameValuePair("msg", myMessage));
UrlEncodedFormEntity ent = new UrlEncodedFormEntity(param,HTTP.ISO_8859_1);
post.setEntity(ent);
HttpResponse responsePOST = client.execute(post);
HttpEntity resEntity = responsePOST.getEntity();
他们可以帮助我解决我的问题吗?
非常感谢