DOWNLOAD SOURCE CODE
Executing A HTTP POST Request with HttpClient.
public void postData() {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://192.168.2.175:8080/script.php");
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("id", "2"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "Vijayakumar!"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
}
Executing A HTTP POST Request with HttpClient.
public void postData() {
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://192.168.2.175:8080/script.php");
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("id", "2"));
nameValuePairs.add(new BasicNameValuePair("stringdata", "Vijayakumar!"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
}
This comment has been removed by the author.
ReplyDeleteI am actually grateful to the holder of this site who has shared
ReplyDeletethis enormous article at here. 메이저사이트
Everyone loves it when folks come together and share opinions.
ReplyDeleteGreat site, stick with it! 경마