Send SMS from your web application

Posted by
Today mobile phone is the most effective way to reach people/customer. Every organization is using it.If you are making an application for any organization and want to add this feature in your application, its quiet easy. There are so many gateways available online. You can use any of them, which ever suits with your requirement. One of them is SMS GATEWAY HUB. You can use its trial pack by registering yourself on SMS Gateway provides HTTP API to embed into your application.Following is HTTP API for sending sms to a group (collection of some contacts).{json|text}&route_id=route+id&callback=Any+Callback+URL&unique=0&sendondate=03-12-2013T01:03:46

You can embed this by following code:
 class sendBulkSMS  
   public static void main(String ar[])  
        String SMSURL = "";  
        String SENDER = "1038";  
        String USERNAME = "java2career";  
        String PASSWORD = "your_password";  
        String TXT = "Hello all java2career fans";  
        String GROUP="1655";  
        String q = "username=" + URLEncoder.encode (USERNAME, "UTF-8");  
        q += "&" + "password=" + URLEncoder.encode (PASSWORD, "UTF-8");  
        q += "&" + "sender=" + SENDER;  
        q += "&" + "message=" + URLEncoder.encode (TXT, "UTF-8");  
       q += "&" + "group=" + URLEncoder.encode (GROUP, "UTF-8");  
       q += "&format={json|text}&unique=0&sendondate=03-12-2013T01:03:46";  
       URL url=new URL(SMSURL);  
        URLConnection conn = url.openConnection();  
        conn.setDoOutput (true);  
        OutputStreamWriter wr = new OutputStreamWriter (conn.getOutputStream());  
        wr.write (q);  
      BufferedReader rd = new BufferedReader (new InputStreamReader (conn.getInputStream()));  
      String line;  
      System.out.println ("Response :");  
      while ((line = rd.readLine()) != null) { System.out.println (line); }  
     catch (Exception e) { }  
SENDER is sender id created by smslogin interface.
GROUP is group id, that you will have to create by clicking on address book->add to send sms to a group.
USERNAME and PASSWORD is which you have choosen on the time of registering yourself on
TXT is the message you want to send. 
Whoaa its done!!!!

Leave a Reply