import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class SPIRIcom_get {
public static void main(String[] args) {
/* Change this to your username */
String user = "myuser";
/* Change this to your password */
String pass = "mypass";
/* This is the short message to be sent */
String msg = "test";
/* Sender of the short message */
String from = "+467123456789";
/* Recipient of the short message */
String to = "+467123456789";
/* Construct the URL */
String urlStr = "http://get.spiricom.spirius.com:55000/cgi-bin/sendsms?User=" + user + "&Pass=" + pass + "&From=" + from + "&To=" + to + "&Msg=" + msg;
String result = "";
try {
/* Open a connection and send the GET-request */
URL url = new URL(urlStr);
URLConnection conn = url.openConnection();
/* Read the response */
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = rd.readLine()) != null) {
sb.append(line);
}
rd.close();
result = sb.toString();
} catch (Exception e) {
result = e.toString(); //e.printStackTrace();
}
System.out.println(result);
}
}