Twilio短信断线不起作用

时间:2015-09-22 11:57:03

标签: sms twilio

我是Twilio用户,我尝试在API资源管理器页面上的sms正文表单上执行换行符(使用\ n命令),但它不起作用。

您可以在这里找到截图:

enter image description here

非常感谢

2 个答案:

答案 0 :(得分:1)

我通过PHP脚本尝试了以下代码并且工作正常,无需转义新行。

  <?php
      require('/Users/user/Documents/Twilio/Development/PHP/libraries/twilio-php-master/Services/Twilio.php'); // This line loads the helper library

      $sid = "XXXXXXXXX"; // Your Account SID from www.twilio.com/user/account
      $token = "YYYYYYYY"; // Your Auth Token from www.twilio.com/user/account

      $client = new Services_Twilio($sid, $token); // instance of the Twilio helper REST Client

      $from = "+1 415-319-1111"; // a valid Twilio number
      $to =  "+1408-319-2222"; // your mobile number
      $body = "Ahoy from Twilio!\n New line"; // sms message body

      try {
        $message = $client->account->messages->sendMessage( $from, $to, $body);
        echo $message->sid; // Twilio's identifier for the new message
      } catch (Services_Twilio_RestException $e) {
          echo $e->getMessage(); // A message describing the REST error
      }
    ?>

答案 1 :(得分:0)

Twilio开发者传道者在这里。

这可能是API浏览器为您逃避的事情。我刚刚尝试使用Ruby帮助程序库并获得了一条带有换行符的SMS消息。您是否尝试过使用API​​本身?