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.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度