Register Now  Support - Call Us : 09553760444  
Forgot Password Demo Video 
Test Our Service | Enter Mobile Number   +91     

Resources - Send SMS API library


Code to send SMS in JAVA


Code Sample:

Sample Java API For Sending SMS:

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;

public class SMSSender
{
       public String sendSms(String sToPhoneNo,String sMessage)
       {
          try 
          {
           // Construct data
           String data = "user=" + URLEncoder.encode("textlocalusername****", "UTF-8");
           data += "&password=" + URLEncoder.encode("textlocalpassword****", "UTF-8");
           data += "&message=" + URLEncoder.encode(sMessage, "UTF-8");
           data += "&sender=" + URLEncoder.encode("OPTINS", "UTF-8");
           data += "&mobile=" + URLEncoder.encode(sToPhoneNo, "UTF-8");
           data += "&type=" + URLEncoder.encode(1, "UTF-8");
           // Send data
           URL url = new URL("https://www.bulksmsgateway.in/sendmessage.php");
           URLConnection conn = url.openConnection();
           conn.setDoOutput(true);
           OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
           wr.write(data);
           wr.flush();
           // Get the response
           BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
           String line;
           String sResult="";
           while ((line = rd.readLine()) != null) 
           {
                 // Process line...
                 sResult=sResult+line+" ";
           }
           wr.close();
           rd.close();
           return sResult;
           } 
               catch (Exception e) 
               {
                  System.out.println("Error SMS "+e);
                  return "Error "+e;
               }
        }
}



Please note that some of the above code has been supplied to Bulk SMS Gateway 
by clients. As such, accuracy is not guaranteed by Bulk SMS Gateway.

Bulk SMS Service All Over India