Created
November 16, 2011 16:35
-
-
Save RobSpectre/1370578 to your computer and use it in GitHub Desktop.
Line break in a Twilio SMS using SimpleXML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ACCOUNT_SID = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxx"; | |
$AUTH_TOKEN = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyy"; | |
$TWILIO_NUMBER = "+1aaabbbcccc"; | |
$TEST_NUMBER = "+1xxxyyyzzzz"; | |
include 'Services/Twilio.php'; | |
// Use SimpleXML to get the message body. | |
$xml = <<<XML | |
<root> | |
<element>This is a test with a linebreak.\n\n Totally.</element> | |
</root> | |
XML; | |
$simplexml_object = simplexml_load_string($xml); | |
// Send text message | |
$client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN); | |
$client->account->sms_messages->create( | |
$TWILIO_NUMBER, | |
$TEST_NUMBER, | |
trim($simplexml_object->element) | |
); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment