Sending a message from a website
Sending messages from a website has many uses; sending notifications to users is one good example. In this example, we're going to present you with a form where you can enter a phone number and message and send it to your user. This can be quickly adapted for other uses.
Getting ready
The complete source code for this recipe can be found in the Chapter6/Recipe1/
folder.
How to do it...
Ok, let's learn how to send an SMS message from a website. The user will be prompted to fill out a form that will send the SMS message to the phone number entered in the form.
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 ?>
Upload a file called...