Return to Snippet

Revision: 29494
at July 30, 2010 12:48 by smsmatrix


Initial Code
try
{
 String MATRIXURL = "http://www.smsmatrix.com/matrix";
 String PHONE = "12506063167";
 String USERNAME = "[email protected]";
 String PASSWORD = "pass72727";
 String TXT = "This is a test, pls ignore";

 String q = "username=" + URLEncoder.encode (USERNAME, "UTF-8");
 q += "&" + "password=" + URLEncoder.encode (PASSWORD, "UTF-8");
 q += "&" + "phone=" + PHONE;
 q += "&" + "txt=" + URLEncoder.encode (TXT, "UTF-8");

 URL url = new URL (MATRIXURL);
 URLConnection conn = url.openConnection();
 conn.setDoOutput (true);
 OutputStreamWriter wr = new OutputStreamWriter (conn.getOutputStream());
 wr.write (q);
 wr.flush();
    
 BufferedReader rd = new BufferedReader (new InputStreamReader (conn.getInputStream()));
 String line;
 System.out.println ("Matrix API Response :");
 while ((line = rd.readLine()) != null) { System.out.println (line); }
 wr.close();
 rd.close();
} catch (Exception e) { }

Initial URL
http://www.smsmatrix.com/?sms-gateway

Initial Description

                                

Initial Title
Send SMS vis SMS Gateway using Java

Initial Tags
java

Initial Language
Java