在客户端使用HttpPost方式提交数据:
public static String toCallOnServer(String path,String encode) throws ClientProtocolException, IOException{
HttpPost httpPost = new HttpPost(pathString +path);
DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(httpPost);
httpPost.addHeader("Content-Type", "text/html");
httpPost.addHeader("charset", HTTP.UTF_8);
if(response.getStatusLine().getStatusCode()==200){
InputStream inputStream = response.getEntity().getContent();
return getContext(inputStream, encode);
}
return "";
}
这么写试试看