Forwarding SMS messages to another phone number
This recipe can be handy when you want to forward SMS messages you received from one phone number on your cell phone.
Getting ready
The complete source code for this recipe can be found in the Chapter6/Recipe3/
folder.
How to do it...
We're about to build a web app that will listen to incoming SMS messages and forward them to another phone number.
Download the Twilio Helper Library from https://github.com/twilio/twilio-php/zipball/master and unzip it.
Upload the
Services/
folder to your website.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 $toNumber = ''; // YOUR PHONE NUMBER TO FORWARD SMS TO ?>
Upload
forward.php
to your server and add the following code to it:<?php include 'Services/Twilio.php'; include("config.php"); include("functions.php...