Use this API to send text messages from Java.

  • Simple HTTP request
  • Encrypted communication over SSL
  • Long SMS (up to 765 characters)
  • Delivery status via function return code
  • Email replies

Example

public static int SendSMS(String AccountID, String Email, String Password,
String Recipient, String Message, StringBuffer Response)
{
String RequestURL = "http://www.redoxygen.net/sms.dll?Action=SendSMS";

String Data = ("AccountId=" + URLEncoder.encode(AccountID, "UTF-8"));
Data += ("&Email=" + URLEncoder.encode(Email, "UTF-8"));
Data += ("&Password=" + URLEncoder.encode(Password, "UTF-8"));
Data += ("&Recipient=" + URLEncoder.encode(Recipient, "UTF-8"));
Data += ("&Message=" + URLEncoder.encode(Message, "UTF-8"));

int Result = -1;
URL Address = new URL(RequestURL);

HttpURLConnection Connection = (HttpURLConnection) Address.openConnection();
Connection.setRequestMethod("POST");
Connection.setDoInput(true);
Connection.setDoOutput(true);

DataOutputStream Output;
Output = new DataOutputStream(Connection.getOutputStream());
Output.writeBytes(Data);
Output.flush();
Output.close();

BufferedReader Input = new BufferedReader(new InputStreamReader(Connection.getInputStream()));
StringBuffer ResponseBuffer = new StringBuffer();
String InputLine;

while ((InputLine = Input.readLine()) != null)
{
ResponseBuffer = ResponseBuffer.append(InputLine);
ResponseBuffer = ResponseBuffer.append("\n\n\n");
}

Response.replace(0, 0, ResponseBuffer.toString());
String ResultCode = Response.substring(0, 4);
Result = Integer.parseInt(ResultCode);
Input.close();

return Result;
}

Your Options

Trial Account

Download