答案 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本身?