Replying to a message from the phone
When a user replies to a message from his/her phone, we want to store it in the database so that we can review the messages later.
Getting ready
The complete source code for this recipe can be found in the Chapter6/Recipe2/
folder.
How to do it...
We're going to build a simple app that will receive SMS messages and store them in a database. When we receive SMS messages, we will store them inside the database along with the phone number the message came from and the unique SID.
Download the Twilio Helper Library from https://github.com/twilio/twilio-php/zipball/master and unzip it.
Upload the
Services/
folder to your website.Create a MySQL database and load the contents of
sql.sql
into the database.Upload
config.php
to your website and make sure the following variables are set as follows:<?php $accountsid = ''; // YOUR TWILIO ACCOUNT SID $authtoken = ''; // YOUR TWILIO AUTH TOKEN $fromNumber = ''; // PHONE NUMBER CALLS WILL COME FROM $dbhost = '';...