import java.util.ArrayList;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
public class Sample_JAVA {
public void sendSmsService(String msg, String mobile){
try {
HttpParams params = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(params, 15000);
HttpConnectionParams.setSoTimeout(params, 15000);
HttpClient httpclient = new DefaultHttpClient(params);
HttpPost httppost = new HttpPost("http://sms.textware.lk:5000/sms/send_sms.php?");
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("src", "zzzz"));
nameValuePairs.add(new BasicNameValuePair("username", "yyyyy"));
nameValuePairs.add(new BasicNameValuePair("password", "aaaa"));
nameValuePairs.add(new BasicNameValuePair("dst", mobile));
nameValuePairs.add(new BasicNameValuePair("msg", msg));
nameValuePairs.add(new BasicNameValuePair("dr", "1"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
int statusCode = response.getStatusLine().getStatusCode();
System.out.println(statusCode);
} catch (Exception e) {
System.out.println(e.toString());
}
}
}