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

Blacklisting and whitelisting the submissions


Being able to blacklist and whitelist the submissions is also important to include trusted users or exclude abusive ones.

In our case, we're going to set up two arrays, one for blacklisted numbers and one for whitelisted numbers.

If a phone sends an image, we'll first check to see whether the phone number is in the blacklist and if not, then we'll check the whitelist.

If the phone number is in the blacklist, then we ignore it. If it's in the whitelist, then we skip the filtering we placed in the previous recipe and upload the photo directly to the gallery.

Just like the previous recipe, we won't change all of the files. We will just update our previously updated gallery. The files that we will change are config.php, functions.php, and listener.php.

Getting ready

The complete code for this recipe can be found in the Code/Recipe5/ folder.

How to do it…

Let's set up a blacklist and whitelist on our photo gallery now.

  1. Let's update config.php with our Twilio...