Friday, December 9, 2011

comment_icon 175 Sending sms via way2sms using Java


API NOT WORKING ANYMORE - INDYAROCKS MESSAGE NOT GETTING DELIVERED

i have a paid API
If you are willing to pay small amount such as 50-100RS for 100-300sms
contact me at abhirathore2006@gmail.com

The sole purpose of the Api is to be used in development by students.so i am not releasing the actual sour

UPDATED CODE
This Tutorial showz 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, if you missuse the api i will
 remove it so make sure you wont misuse it
author : Abhimanyu singh rathore
email : abhirathore2006@gmail.com
website: www.how2labs.info


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>