Tuesday, June 25, 2013

SENDING SMS VIA WAY2SMS USING JAVA

way2sms using Java

UPDATED CODE

This tutorial shows that how you can use the http://www.indyarocks.com/ for sending message using your java application 

Steps to Follow
  1. create a account on http://www.indyarocks.com/ 
  2. after getting indiarocks username and password use the code given below.
  3. modify the following details
    1. put your email id in Email string
    2. put your indiarocks username
    3. put your indiarocks password
    4. put number as the number on which you want to send sms
    5. put your messgae in messgae string , i limited the length to 110 char for stopping the misuse
  4. if you copy the code in your application's jsp page don't forget to import java.net.*,java.io.*,java.net.URLEncoder
Example JSP code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%@page
 language="java" import="java.net.*,java.io.*,java.net.URLEncoder;" contentType="text/html; charset=ISO-8859-1"
 pageEncoding="ISO-8859-1"%>

<html>
<head>
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<%
/* This api is only for developemnt purpose.

info : make sure to use valid email otherwise it won't work,message char limit is 110

**/
String email="put your email id here"; 
String user=" your Indiarocks username";
String pass=" your Indiarocks password";
String number="some number on which you want to send msg";
String msg="your message to send" ; 
String mURL="http://www.onl9class.com/smsapi/smsir.php?email="+email+"&user="+user+"&pass="+pass+"&number="+number+"&msg="+URLEncoder.encode(msg, "UTF-8");;
URL url = new URL(mURL);
BufferedReader reader = null;

try {
    reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));

    for (String line; (line = reader.readLine()) != null;) {
        out.println(line);
    }
} finally {
    if (reader != null) try { reader.close(); } catch (IOException ignore) {}
}
 %>
</body>
</html>


You might also like:

10 Fastest Supercomputers In The World



SENDING SMS VIA WAY2SMS IN ASP.NET C#



1 comment:

  1. Technicalideas Books Notes Programs Tips: Sending Sms Via Way2Sms Using Java >>>>> Download Now

    >>>>> Download Full

    Technicalideas Books Notes Programs Tips: Sending Sms Via Way2Sms Using Java >>>>> Download LINK

    >>>>> Download Now

    Technicalideas Books Notes Programs Tips: Sending Sms Via Way2Sms Using Java >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete