2024年2月27日发(作者:)

public void MyFunction{

HttpClient httpclient = new DefaultHttpClient();

//你的URL

HttpPost httppost = new HttpPost("/post_");

try {

List nameValuePairs = new ArrayList(2);

//Your DATA

(new BasicNameValuePair("id", "12345"));

(new BasicNameValuePair("stringdata", " is Cool!"));

ity(new UrlEncodedFormEntity(nameValuePairs));

HttpResponse response;

response=e(httppost);

} catch (ClientProtocolException e) {

// TODO Auto-generated catch block

tackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

tackTrace();

}

}