dongzhouji4021 2016-04-02 18:25
浏览 105

Textbelt SMS API - 无法发送短信

I would like to send SMS thank to the "Textbelt" API (more informations on https://github.com/typpo/textbelt and http://textbelt.com/ ). I tried several methods (php, browser extension, jquery etc...) but I got each time a bug and it displayed "null" variables or error messages (with some "echo" and "var_dump" for testing). Just one solution seems to work, but no SMS is sent. Indeed, when I start this script, I get in a red board "{ "success": true }" but no SMS is sent. Have you some ideas in order to fix it please ? Did I make a mistake ?

Here is the code of this short script :

<!DOCTYPE HTML>
<html>
    <head>
    <meta charset='utf-8'>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 
    <script>

$(function(){
  var g=  $.post("http://textbelt.com/intl",
  {
    number: "0033xxxxxxxxx",
    message: "testing https://github.com/typpo/textbelt"
  }
  ).done(function (){
    $('#output1').html(g.responseText); 
  });
} 

);

    </script>
    <style>
        #output2 {
                border: 2px solid green;
        }
  #output1 {
                border: 2px solid red;
        }
    </style>
</head>
<body>
<div id="output1"></div>
<div id="output2"></div>
</body>

  • 写回答

1条回答 默认 最新

  • dongquanyu5816 2016-04-07 16:59
    关注

    I am not sure about other causes, but from your script, I notice that your phone number starts with "0033...". My understanding is that, for phones outside the USA, the number formatting has to be standard (+336...).

    The script behind TextBelt does a brute-force sequential sending of the message to the e-mail gateways of all known carriers in the country by using the phone number you submitted, then formatting it for each specific individual carrier's gateway (ex: 337xxxxxxxx@orange.fr) and trying to send it to that carrier, then going to the next, until it sends to all. Eventually, it will succeed with one of them and the message will be delivered properly.

    A plain vanilla HTML form like this one works (I tested it):

    <form action=http://textbelt.com/intl method="post" name=TextMessage>
    <p>
    Number: <input type=text name=number>
    </p>
    <p>
    Message: <input type=text name=message>
    </p>
    <p>
    <input type=Submit name=Submit value=Submit>
    </form>
    

    I hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料