Java发送和接收短信。免费短信网关?

发布于 2024-10-02 13:29:33 字数 764 浏览 3 评论 0原文

在 SOverflow 上的一些问题上,我发现这个。但它说目前不可用,并且可能永远不会可用。

基于 我意识到没有必要构建自己的短信服务。

所以问题是:

我的java应用程序必须向用户发送SMS消息并从用户接收SMS消息。 我真的需要支付一些短信网关的费用吗?还是有一些免费的短信网关(当然有一些限制)可以用来测试我的应用程序?

Simplewire Kit 看起来非常简单,但演示示例失败了,因为我没有 Simplewire 帐户。 Simplewire 文档称发送短信有 30 天的试用期。但这适用于两种方式:

“对于 2 种方式,演示积分不可用,因为您需要 Simplewire 网络上托管的自己的手机号码。简单线 支持许多不同国家和地区的2路号码 代码。请联系 Simplewire 了解更多信息。”

On some questions here on SOverflow I found THIS. But it says that it is not avaiable at the moment and probably it will never get avaiable.

Based on THIS I realised that there is no need on building my own SMS service.

So the question:

My java application has to send SMS messages to users and receive SMS messages from users.
Do I really need to pay some SMS gateway or is there some free SMS GATEWAY (with some limitations ofcourse) that I could use to test my application?

Simplewire Kit looks really simple but the demo examples are failing because I don' have Simplewire account. Simplewire documentation says that there is a 30-day trial for sending SMS. But this is for two way:

"For 2-Way, demo credits are not available because you will need your
own mobile number hosted on Simplewire’s Network. Simplewire
supports 2-Way numbers for many different countries and area
codes. Please contact Simplewire for more information."

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

尤怨 2024-10-09 13:29:33

仅供参考 Simplewire 现在是 OpenMarket.com/MXTelecom.com

有几个免费的短信网关,但它们都在您的消息中附加短信广告以支付费用。 ZeepMobile 是我听到最多的一个。至于付款,有几种解决方案,但这一切都取决于您的需求。

双向通信需要最终用户订阅您的服务。有几种方法可以解决此问题:

短代码:您可以获取自己的代码 (www.openmarket.com) 或与其他人共享 (www.clickatell.com)
您可以使用一项新服务 www.twilio.com 看起来不错,但尚未测试。

如果您只需要一种通信方式,您可以使用电子邮件到网关短信之类的东西,但是您会需要知道最终用户所在的运营商。

FYI Simplewire is now OpenMarket.com/MXTelecom.com

There are a couple of free SMS gateways but they all attach a SMS ad in your message to pay for the cost. ZeepMobile is the one I hear about the most. As for paying there are a couple of solution but this all depends on your needs.

Two way communication would require the end user to subscribe to your service. There are a few ways to approach this:

Short Code: you could get your own (www.openmarket.com) or share with others (www.clickatell.com)
You could use a new service www.twilio.com looks to be good but haven't tested it yet.

If one way communication is all you need you could so something like email to gateway sms but then you would need to know the carrier the end user is on.

聊慰 2024-10-09 13:29:33

Fowiz 提供免费的基于 Android 的解决方案,用于从应用程序发送/接收短信。您需要在设备上安装他们的 Android 应用程序才能启用此服务,并且消息将在您的手机上发送/接收。您可以设置 CallbackUrl 以接收传入消息的即时通知。 Fowiz 还支持短代码、活动管理、投票等。

通过 Fowiz 发送消息的示例代码:

    String myPasscode = 'your passcode';
    String myUsername = 'your fowiz username';    
    String toPhoneNumber = 'recipient phone number';
    String myMessage = 'your message';

    HttpClient client = new DefaultHttpClient();
    HttpGet request = new HttpGet(HTTP_API + "?username="+myUsername
            "&phonenumber="+toPhoneNumber
    +"&message="+myMessage+"&passcode="+myPasscode);
    HttpResponse response = client.execute(request);

    BufferedReader rd = new BufferedReader
      (new InputStreamReader(response.getEntity().getContent()));

    String line = "";
    StringBuffer response = new StringBuffer();
    while ((line = rd.readLine()) != null) {
              response.append(line);
    }   

    System.out.println(response.toString());

来源:http:// /cloud.fowiz.com/2help.html

Fowiz offers free Android based solution to send/receive text messages from applications. You need to install their Android App on your device to enable this service and the messages are sent/received on your phone. You can setup CallbackUrl to receive instant notification on the incoming messages. Fowiz also supports short codes, campaign management, voting etc.

Sample code to send message via Fowiz:

    String myPasscode = 'your passcode';
    String myUsername = 'your fowiz username';    
    String toPhoneNumber = 'recipient phone number';
    String myMessage = 'your message';

    HttpClient client = new DefaultHttpClient();
    HttpGet request = new HttpGet(HTTP_API + "?username="+myUsername
            "&phonenumber="+toPhoneNumber
    +"&message="+myMessage+"&passcode="+myPasscode);
    HttpResponse response = client.execute(request);

    BufferedReader rd = new BufferedReader
      (new InputStreamReader(response.getEntity().getContent()));

    String line = "";
    StringBuffer response = new StringBuffer();
    while ((line = rd.readLine()) != null) {
              response.append(line);
    }   

    System.out.println(response.toString());

Source: http://cloud.fowiz.com/2help.html

贩梦商人 2024-10-09 13:29:33

是的,您可以在 5 分钟内构建自己的 API。您的 Android 手机可以作为服务器 API 在您的 Java 代码中发送和接收短信。这样做非常简单。有一些基本步骤

  1. 从手机中的 Play 商店下载 Android GSM 调制解调器应用程序 GSM 调制解调器 JAVA 中的免费短信
  2. 您还需要辅助工具来无任何干扰地发送或接收短信。您还可以在 Android 中扩展您的功能 GSM 调制解调器帮助工具< /a>
  3. 如果你想一步步学习。还有指南和视频教程。 用 Java 发送或接收免费短信< /p>

    公共类 SMSSender {
    公共静态无效主(字符串[] args)抛出异常{
    // TODO 自动生成的方法存根
    String message = "垃圾字符?sendMultipartTextMessage方法只发送短信。如果你想发送非短信,你应该看看sendDataMessage方法。下面是来自android cts的代码摘录。它有关于如何发送长消息的示例。" ;      
    字符串电话=“92************”;
    字符串用户名=“abcd”;
    字符串密码=“1234”;
    字符串地址 = "http://192.168.1.101";
    字符串端口=“8090”;
    
    网址 url = 新网址(
            地址+":"+端口+"/SendSMS?用户名="+用户名+"&密码="+密码+
            "&phone="+phone+"&message="+URLEncoder.encode(message,"UTF-8"));
    
    URLConnection 连接 = url.openConnection();
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    字符串输入行;
    while((inputLine = bufferedReader.readLine()) !=null){
        System.out.println(inputLine);
    }
    bufferedReader.close();
    }
    }
    

Yes you can build an API your own within 5 minutes. Your android phone can work as Server API to send and receive SMS in your Java code. It is very simple to do that. there are the some basic steps

  1. Download Android GSM Modem application from playstore in your phone GSM Modem FREE SMS in JAVA
  2. You also need helper tool to send or receive SMS without any disturbance. You also extend your functionality in android as well GSM Modem Helper Tool
  3. If you want to learn step by step. there is also guide and video tutorial. Send or receive FREE SMS in Java

    public class SMSSender {
    public static void main(String[] args) throws Exception{
    // TODO Auto-generated method stub
    String message = "Junk characters? method sendMultipartTextMessage only send text message. If you want to send non text message, you should look to method sendDataMessage. Below is the code excerpt from android cts. It has example on how to send long messages.";      
    String phone = "92***********";
    String username = "abcd";
    String password = "1234";
    String address = "http://192.168.1.101";
    String port = "8090";
    
    URL url = new URL(
            address+":"+port+"/SendSMS?username="+username+"&password="+password+
            "&phone="+phone+"&message="+URLEncoder.encode(message,"UTF-8"));
    
    URLConnection connection = url.openConnection();
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String inputLine;
    while((inputLine = bufferedReader.readLine()) !=null){
        System.out.println(inputLine);
    }
    bufferedReader.close();
    }
    }
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文