public function sendSMS($f3) { // Set response type header('Content-type: application/json'); // Send SMS try { $sentMessages = SMS::createAndSend(['recipient_phone_number' => $f3->get('POST.recipient_phone_number'), 'message_content' => $f3->get('POST.message_content')]); echo json_encode(['status' => 'OK', 'number_of_messages_sent' => $sentMessages]); } catch (Exception $e) { echo json_encode(['status' => 'ERR', 'cause' => $e->getMessage()]); } }