Sample Code Send SMS with HTTP API in Java
I will walk you through a quick and interesting way to send SMS using a simple JAVA Code. I wanted to make it as easy as possible for you, so I have created the web version in order to demonstrate the instructions that I will explain in this article. So, just follow these easy steps as I walk you through the whole process and in no time, sending SMS will be a best JAVA Code.

How to Send SMS using HTTP API in JAVA Code?
import java.io.*; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; public class SendSms{ public static void main(String[] args) { //Your user name String username = "UR_USER"; //Your authentication key String authkey = "UR_KEY"; //Multiple mobiles numbers separated by comma (max 200) String mobiles = "9974984500"; //Sender ID,While using route4 sender id should be 6 characters long. String senderId = "SENDER"; //Your message to send, Add URL encoding here. String message = "Test Message"; //define route String accusage="1"; //Prepare Url URLConnection myURLConnection=null; URL myURL=null; BufferedReader reader=null; //encoding message String encoded_message=URLEncoder.encode(message); //Send SMS API String mainUrl="http://temp.91bulksms.com/submitsms.jsp?"; //Prepare parameter string StringBuilder sbPostData= new StringBuilder(mainUrl); sbPostData.append("user="+username); sbPostData.append("&key="+authkey); sbPostData.append("&mobile="+mobiles); sbPostData.append("&message="+encoded_message); sbPostData.append("&accusage="+accusage); sbPostData.append("&senderid="+senderId); //final string mainUrl = sbPostData.toString(); try { //prepare connection myURL = new URL(mainUrl); myURLConnection = myURL.openConnection(); myURLConnection.connect(); reader= new BufferedReader(new InputStreamReader(myURLConnection.getInputStream())); //reading response String response; while ((response = reader.readLine()) != null) //print response System.out.println(response); //finally close connection reader.close(); } catch (IOException e) { e.printStackTrace(); } } }