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

Sending an SMS to all participants at the time of the call


Once it's time to start the conference, you want everyone to know about it. The best way to do that is to send a text message with a number to call to.

This recipe will check once an hour for any upcoming conferences and send a text message to all participants to let them know about it.

Getting ready

The complete source code for this recipe can be found in the Chapter4/ folder.

How to do it...

This next recipe will create a notification system that will run on an hourly cron job and send an SMS reminder to all participants, and will also have instructions to connect to the conference call.

  1. In the same place you uploaded the previous recipe, upload notify.php as follows:

    <?php
    include("config.php");
    include("pdo.class.php");
    include 'Services/Twilio.php';
    
    $pdo = Db::singleton();
    $client = new Services_Twilio($accountsid, $authtoken);
    
    $curtime = strtotime("+1 hour");
    $sql = "SELECT * FROM conference where `timestamp` >$curtime AND...