【发布时间】:2015-09-22 11:57:02
【问题描述】:
【问题讨论】:
-
请不要链接到外部资源!提供您的问题所需的一切。
【问题讨论】:
我通过 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
}
?>
【讨论】:
这里是 Twilio 开发者宣传员。
这可能是 API 资源管理器为您转义的情况。我刚刚尝试使用 Ruby 帮助程序库并收到一条带有换行符的 SMS 消息。您是否尝试过使用 API 本身?
【讨论】: