File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
appengine/flexible/twilio Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change 2121
2222$ app = new Application ();
2323
24- $ app ['twilio ' ] = function ($ app ) {
25- return new Services_Twilio (
26- $ app ['twilio.account_sid ' ],
27- $ app ['twilio.auth_token ' ]
28- );
29- };
30-
3124# [START receive_call]
3225/***
3326 * Answers a call and replies with a simple greeting.
4336});
4437# [END receive_call]
4538
46-
4739# [START send_sms]
4840/***
4941 * Send an sms.
5042 */
5143$ app ->post ('/sms/send ' , function (Request $ request ) use ($ app ) {
52- /** @var Services_Twilio $twilio */
53- $ twilio = $ app ['twilio ' ];
44+ $ twilio = new Services_Twilio (
45+ $ app ['twilio.account_sid ' ], // Your Twilio Account SID
46+ $ app ['twilio.auth_token ' ] // Your Twilio Auth Token
47+ );
5448 $ sms = $ twilio ->account ->messages ->sendMessage (
5549 $ app ['twilio.number ' ], // From this number
5650 $ request ->get ('to ' ), // Send to this number
5751 'Hello from Twilio! '
5852 );
59-
6053 return sprintf ('Message ID: %s, Message Body: %s ' , $ sms ->sid , $ sms ->body );
6154});
6255# [END send_sms]
6962 $ sender = $ request ->get ('From ' );
7063 $ body = $ request ->get ('Body ' );
7164 $ message = "Hello, $ sender, you said: $ body " ;
72-
7365 $ response = new Services_Twilio_Twiml ();
7466 $ response ->message ($ message );
7567 return new Response (
You can’t perform that action at this time.
0 commit comments