1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.

Saturday, February 20, 2010

Way2SMS Source Exposed

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Iterator;
import java.util.Vector;

public class SMS {
public static void send(String uid, String pwd, String phone, String msg)
throws IOException {
if ((uid == null) || (uid.length() == 0)) {
throw new IllegalArgumentException("User ID should be present.");
}
uid = URLEncoder.encode(uid, "UTF-8");

if ((pwd == null) || (pwd.length() == 0)) {
throw new IllegalArgumentException("Password should be present.");
}
pwd = URLEncoder.encode(pwd, "UTF-8");

if ((phone == null) || (phone.length() == 0)) {
throw new IllegalArgumentException(
"At least one phone number should be present.");
}
if ((msg == null) || (msg.length() == 0)) {
throw new IllegalArgumentException("SMS message should be present.");
}
msg = URLEncoder.encode(msg, "UTF-8");

Vector numbers = new Vector();

if (phone.indexOf(59) >= 0) {
String[] pharr = phone.split(";");
for (String t : pharr)
try {
numbers.add(Long.valueOf(t));
} catch (NumberFormatException ex) {
throw new IllegalArgumentException(
"Give proper phone numbers.");
}
} else {
try {
numbers.add(Long.valueOf(phone));
} catch (NumberFormatException ex) {
throw new IllegalArgumentException("Give proper phone numbers.");
}
}

if (numbers.size() == 0) {
throw new IllegalArgumentException(
"At least one proper phone number should be present to send SMS.");
}
String temp = "";
String content = "username=" + uid + "&password=" + pwd;
URL u = new URL("http://wwwa.way2sms.com/auth.cl");
HttpURLConnection uc = (HttpURLConnection) u.openConnection();
uc.setDoOutput(true);
uc
.setRequestProperty(
"User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5");
uc.setRequestProperty("Content-Length", String
.valueOf(content.length()));
uc.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
uc.setRequestProperty("Accept", "*/*");
uc.setRequestProperty("Referer", "http://wwwg.way2sms.com//entry.jsp");
uc.setRequestMethod("POST");
uc.setInstanceFollowRedirects(false);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(uc
.getOutputStream()), true);
pw.print(content);
pw.flush();
pw.close();
BufferedReader br = new BufferedReader(new InputStreamReader(uc
.getInputStream()));
while ((temp = br.readLine()) != null) {
System.out.println(temp);
}
String cookie = uc.getHeaderField("Set-Cookie");

u = null;
uc = null;
for (Iterator localIterator = numbers.iterator(); localIterator
.hasNext();) {
long num = ((Long) localIterator.next()).longValue();

content = "custid=undefined&HiddenAction=instantsms&Action=custfrom450000&login=&pass=&MobNo="
+ num
+ "&textArea="
+ msg;
u = new URL("http://wwwa.way2sms.com/FirstServletsms?custid=");
uc = (HttpURLConnection) u.openConnection();
uc.setDoOutput(true);
uc
.setRequestProperty(
"User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5");
uc.setRequestProperty("Content-Length", String.valueOf(content
.getBytes().length));
uc.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
uc.setRequestProperty("Accept", "*/*");
uc.setRequestProperty("Cookie", cookie);
uc.setRequestMethod("POST");
uc.setInstanceFollowRedirects(false);
pw = new PrintWriter(new OutputStreamWriter(uc.getOutputStream()),
true);
pw.print(content);
pw.flush();
pw.close();
br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
while ((temp = br.readLine()) != null)
;
br.close();
u = null;
uc = null;
}

u = new URL("http://wwwa.way2sms.com/jsp/logout.jsp");
uc = (HttpURLConnection) u.openConnection();
uc
.setRequestProperty(
"User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5");
uc.setRequestProperty("Accept", "*/*");
uc.setRequestProperty("Cookie", cookie);
uc.setRequestMethod("GET");
uc.setInstanceFollowRedirects(false);
br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
while ((temp = br.readLine()) != null)
;
br.close();
u = null;
uc = null;
}
}

best web hosting plan providers-cochin/kerala

cellphone application developers Kerala/India

9 comments:

  1. This will work for you. If it stop working after some days logon to way2sms.com click on Quick SMS link take view source and check the value of input with name Action copy the value and change the value of Action in the below statement in the code
    content = "custid=undefined&HiddenAction=instantsms&Action=custfrom450000&login=&pass=&MobNo="
    + num
    + "&textArea="
    + msg;

    ReplyDelete
  2. built is showing successful but i am not receiving any sms.. please help

    ReplyDelete
  3. i found

    //custid="+custid+"&sponserid="+sponserid+""
    //input type="hidden" name="custid" value=""
    //input type="hidden" name="HiddenAction" value="instantsms"
    input type="hidden" name="Action" value="custfrom1000000"
    input type="hidden" name="login" value="">
    input type="hidden" name="pass" value="">

    and changed Action=custfrom450000 to custfrom1000000

    no results yet

    ReplyDelete
  4. check out another cool india free sms portal called SMS2MINT...

    About SMS2MINT (http://www.sms2mint.com)
    sms2mint.com is an online portal to send and receive SMS online without a mobile phone to any mobile in India. Our Web SMS solutions allow you to send and receive texts online. You just logon, and start sending text messages directly from the Web SMS interface.
    SMS2MINT enables you to send unlimited messages to your friends and family to any mobile number in India at free of cost. It is a great site to maintain constant contact with friends via sms. Using the mobile version, you can send quick free SMS directly from mobile itself.

    Key features at a glance:

    • Send SMS and Group SMS upto 140 characters for FREE from your computer to any mobile in India
    • Receive SMS using our premium short code without a mobile
    • A state of the art interface to manage your account
    • Unlimited Storage for sent and received messages
    • Supports all mobile networks in India
    • It’s perfect for connecting with friends, family, customers, staff and other stakeholders
    • SMS2MINT is aspiring to become a one stop shop for all your SMS needs
    • You don't need to send SMS from your phone anymore; do it online!
    • If you're at school, home or work, this site will allow you to send free SMS
    • NRIs get in touch with friends and family in India for FREE
    • Get rewarded for anything and everything you do on SMS2MINT
    • Redeem rewards for free gifts
    • Invite friends and get rewarded for everything they do once they join
    • Address book for contact management

    And for the corporates / Businesses

    • Bulk SMS at competitive rates without sacrificing quality and reliability
    • Contextual advertising solutions
    • Publisher solutions
    • Short code keywords
    • Banner Ads

    And this list is ever growing… so stay tuned!!!

    Why SMS2MINT

    Although there are many portals providing similar services, sms2mint thrives on the quality of experience for its users, whether they are using it for FREE or not. SMS2MINT has solutions for both individual users as well as corporates, and our portfolio of services is constantly growing.

    Another nitch SMS2MINT offers is that not only our users will be able to get the services for FREE, but also they would be able to earn rewards by using our services and spreading the word.

    Our goal is to make sms2mint a one stop shop for all your SMS needs, and we’ll work hard to keep this service FREE for our individual users and very competitive for our corporate front.

    Corporates! We want to earn your business, so we’ll go an extra mile to do so without compromising the quality of service. Quality is our motto and we’ll stick to that.

    Although there are other portals providing SMS sending, not all of them are comparable. SMS2MINT stands apart from those who charge for these services by providing better service for FREE. Similarly SMS2MINT stands apart from those portals as well which provide such services for FREE, this time in terms of quality and variety of services.

    We want to redefine the meaning of word FREE. FREE does not mean lacking in other features such as quality, user experience, ease of use, service portfolio and so on.

    We at SMS2MINT are very particular about the quality of service and a rich user experience. Be it the user interface or the flow of site, we have created a product that’s rich in quality and provides a fulfilling user experience.

    In addition we are providing much richer set of services, all FREE for individual users.

    On the same grounds, our philosophy for corporate front is to provide a better service at a better price without compromising on quality and reliability.

    So overall we think that SMS2MINT is going to become a widely used portal for SMS related services, both for individuals and corporates.

    ReplyDelete
  5. please guide me on how to put this code pls
    this is my email address
    hydroxy.lesnar@gmail.com

    ReplyDelete
  6. plz check the php implementation which will works for you in any case no need to change the custfrom value

    ReplyDelete
  7. hi

    it shows one error in the following line
    for (long num : numbers)
    incompactible types long required
    help me

    ReplyDelete
  8. Works perfectly after changing the "Action=" thingy

    ReplyDelete
  9. Any other solution except for changing action thing other than php?

    ReplyDelete

Related Posts with Thumbnails