netbeans - way2sms api not working in java -


i using way2sms api in web application. working fine not able send sms. can tell me must have gone wrong suddenly. api outdated? or there problems way2sms site or gateway?

here's code wrote, you'll find useful.

import java.net.*; import java.io.*;  public class smssender {   //replace way2sms username , password below   static final string _username = "your way2sms username";   static final string _password = "your way2sms password";   static final string _url = "http://ubaid.tk/sms/sms.aspx";   static final string charset = "utf-8";    //to build query string send message   private static string buildrequeststring(string targetphoneno, string message) throws unsupportedencodingexception   {     string [] params = new string [5];     params[0] = _username;     params[1] = _password;     params[2] = message;     params[3] = targetphoneno;     params[4] = "way2sms";      string query = string.format("uid=%s&pwd=%s&msg=%s&phone=%s&provider=%s",         urlencoder.encode(params[0],charset),         urlencoder.encode(params[1],charset),         urlencoder.encode(params[2],charset),         urlencoder.encode(params[3],charset),         urlencoder.encode(params[4],charset)         );     return query;   }    public static void sendmessage(string reciever, string message) throws exception   {     //to establish connection , perform post request     urlconnection connection = new url(_url + "?" + buildrequeststring(reciever,message)).openconnection();     connection.setrequestproperty("accept-charset", charset);      //this automatically fires request , can use determine response status     inputstream response = connection.getinputstream();     bufferedreader br = new bufferedreader(new inputstreamreader(response));     system.out.println(br.readline());   }    public static void main(string [] args)     throws exception   {     string testphoneno = "9876543210";     string testmessage = "sending messages java not hard";      sendmessage(testphoneno,testmessage);   } } 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -