Twilio Cookbook
上QQ阅读APP看书,第一时间看更新

Introduction

One of the common requests I receive from clients is the option to send surveys via SMS. This chapter is based on the survey builders I've built for my clients.

Surveys are handy for seeing what features users want to build into a web app next, running contests, and generally gathering opinions.

In the first section, you'll have a way to let your users subscribe to your surveys. Then you'll build a survey builder that lets you view stats on sent surveys and also send new surveys. We'll include tracking here so that you can see what responses people send back and also give users the ability to unsubscribe from surveys.

Finally, we'll add some handy charting so that we can view the survey results on a nice chart.

This chapter will involve some SQL; you can find the sql file in the Chapter3/ folder.

We're also going to use a class to use PHP's PDO library for database handling. This file is called pdo.class.php and can be found in the Chapter3/ folder.

There are many ways to connect to databases in PHP, but I prefer the PDO driver because you can actually quickly tell it to connect to MySQL, SQLite, or PostgreSQL. In this book, we'll be using MySQL when we use databases.