In this tutorial we will show how to and SMS sending capabilities to your project. We will add a button to one of List page and that button will send record info via SMS to the current logged user.
[size="4"]
Note that Twilio is not free. Their rates depend on number of messages you going to send and many other things.
[size="4"][font="Trebuchet MS"]2. Download Twilio PHP client code and unzip Services folder to your output directory.[/size]
This will create Services folder with one file (Twilio.php) and one folder (Twilio) in there.
[size="4"]
Assuming that cell_phone is a field in the login table we can use AfterSuccessfulLogin event. That's the phone number where we will be sending SMSs.
AfterSuccessfulLogin event:
$_SESSION["cell_phone"]=$userdata["cell_phone"];
[size="4"][font="Trebuchet MS"]4. Add button to the List page grid.[/size]

Proceed to Twilio control panel and note your phone number, Account SID and Auth Token. You are going to need them soon.

Button Server event code
require "Services/Twilio.php";
$AccountSid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$AuthToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$TwilioNumber="xxx-xxx-xxxx";
$http = new Services_Twilio_TinyHttp('https://api.twilio.com';, array('curlopts' => array(
CURLOPT_SSL_VERIFYPEER => false
)));
$client = new Services_Twilio($AccountSid, $AuthToken, null, $http);
$record = $button->getCurrentRecord();
$sms = $client->account->messages->sendMessage(
$TwilioNumber,
$_SESSION["cell_phone"],
"Make: ".$record["Make"]."\n".
"Model: ".$record["Model"]."\n".
"YearOfMake: ".$record["YearOfMake"]."\n".
"Price: ".$record["Price"]
);