我对通过java应用程序发送短信的这个概念不熟悉,你能不能通过说明从应用程序发送短信的方法来帮助我
答案 0 :(得分:1)
是的,你可以通过java应用程序发送短信。但你需要有一个短信发送网关。
答案 1 :(得分:1)
答案 2 :(得分:1)
是的,您可以通过Java发送短信,但为此您需要短信网关提供商。有一些网关提供商允许您免费发送短信,如way2ms,indyarocks等。
对于indyarocks,您可以参考以下代码:
String email = "//your mail id"; //http://www.indyarocks.com/
String user = "//indyarocks user id";
String pass = "//indyarocks password";
String number = ""; //no on which sms is to be send
String msg = "";//message to be send
try{
try {
String mURL;
mURL = "http://www.onl9class.com/smsapi/smsir.php?email=" + email + "&user=" + user + "&pass=" + pass + "&number=" + number + "&msg=" + URLEncoder.encode(msg, "UTF-8");
URL url = new URL(mURL);
BufferedReader reader = null;
reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
String aline;
aline = reader.readLine();
while (aline != "")
{
JOptionPane.showMessageDialog(null,""+aline);
break;
}
if (reader != null)
{
try
{
reader.close();
} finally
{
System.out.println("Error ");
}
}
} catch (Exception ex)
{
System.out.println("Error "+ex);
}
} catch(Exception ex){
}