Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 0165f60953
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 18 lines (13 sloc) 0.613 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<?php
$body = isset($_REQUEST['Body'])? trim($_REQUEST['Body']) : null;
$body = strtolower($body);

$invalid_option = AppletInstance::getDropZoneUrl('invalid-option');
$keys = (array) AppletInstance::getValue('keys[]');
$responses = (array) AppletInstance::getDropZoneUrl('responses[]');
$menu_items = AppletInstance::assocKeyValueCombine($keys, $responses, 'strtolower');

$response = new TwimlResponse;

if(array_key_exists($body, $menu_items) && !empty($menu_items[$body]))
$response->redirect($menu_items[$body]);
elseif(!empty($invalid_option))
$response->redirect($invalid_option);

$response->respond();
Something went wrong with that request. Please try again.