Book Image

Twilio Cookbook: Second Edition

By : Roger Stringer
Book Image

Twilio Cookbook: Second Edition

By: Roger Stringer

Overview of this book

Table of Contents (20 chapters)
Twilio Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Letting users subscribe to receive surveys


Before we can send surveys, we want to have a way for users to subscribe to them.

This form will let users enter their phone numbers and add them to the survey system.

You can put this page on a section of your website and allow people to sign up to receive your surveys.

Getting ready

The complete source code for this recipe can be found in the Chapter3/ folder of the code bundle available at http://www.packtpub.com/support.

How to do it...

Let's build a handy system to let users subscribe to receive our surveys. Perform the following steps:

  1. Load the sql.sql file into your database.

  2. Upload config.php to your website and make sure the following variables are set:

    <?php
    $accountsid = '';  //  YOUR TWILIO ACCOUNT SID
    $authtoken = '';   //  YOUR TWILIO AUTH TOKEN
    $fromNumber = '';  //  PHONE NUMBER CALLS WILL COME FROM
    
    $dbhost = '';  //  YOUR DATABASE HOST
    $dbname = '';  //  YOUR DATABASE NAME
    $dbuser = '';  //  YOUR DATABASE USER
    $dbpass = '';  //  YOUR...