[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 ============= 2 Messages 3 ============= 4 5 Sending a Message 6 ===================== 7 8 The :class:`Messages <Services_Twilio_Rest_Messages>` resource allows you to 9 send outgoing SMS or MMS messages. 10 11 .. code-block:: php 12 13 require('/path/to/twilio-php/Services/Twilio.php'); 14 15 $client = new Services_Twilio('AC123', '123'); 16 $message = $client->account->messages->sendMessage( 17 '+14085551234', // From a Twilio number in your account 18 '+12125551234', // Text any number 19 'Hello monkey!', // Message body (if any) 20 array('http://example.com/image.jpg'), // An array of MediaUrls 21 ); 22 23 echo $message->sid; 24 25 Listing Messages 26 ==================== 27 28 It's easy to iterate over your messages. 29 30 .. code-block:: php 31 32 $client = new Services_Twilio('AC123', '123'); 33 foreach ($client->account->messages as $message) { 34 echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body; 35 } 36 37 Filtering Messages 38 ====================== 39 40 Let's say you want to find all of the messages that have been sent from 41 a particular number. You can do so by constructing an iterator explicitly: 42 43 .. code-block:: php 44 45 $client = new Services_Twilio('AC123', '123'); 46 foreach ($client->account->messages->getIterator(0, 50, array( 47 'From' => '+14105551234', 48 )) as $message) { 49 echo "From: {$message->from}\nTo: {$message->to}\nBody: " . $message->body; 50 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |