Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions appengine/flexible/twilio/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@

$app = new Application();

$app['twilio'] = function ($app) {
return new Services_Twilio(
$app['twilio.account_sid'],
$app['twilio.auth_token']
);
};

# [START receive_call]
/***
* Answers a call and replies with a simple greeting.
Expand All @@ -43,20 +36,20 @@
});
# [END receive_call]


# [START send_sms]
/***
* Send an sms.
*/
$app->post('/sms/send', function (Request $request) use ($app) {
/** @var Services_Twilio $twilio */
$twilio = $app['twilio'];
$twilio = new Services_Twilio(
$app['twilio.account_sid'], // Your Twilio Account SID
$app['twilio.auth_token'] // Your Twilio Auth Token
);
$sms = $twilio->account->messages->sendMessage(
$app['twilio.number'], // From this number
$request->get('to'), // Send to this number
'Hello from Twilio!'
);

return sprintf('Message ID: %s, Message Body: %s', $sms->sid, $sms->body);
});
# [END send_sms]
Expand All @@ -69,7 +62,6 @@
$sender = $request->get('From');
$body = $request->get('Body');
$message = "Hello, $sender, you said: $body";

$response = new Services_Twilio_Twiml();
$response->message($message);
return new Response(
Expand Down