I am making a PHP website I am trying to send a message using Twilio whenever the user enters the telephone number in the website. Currently it only sends a message to the number I wrote in my code. How can I make it send to the entered number?
<?php
require('Twilio.php');
// ==== Control Vars =======
$strFromNumber = "";
$strToNumber = "";
$strMsg = "Hey!! ";
$aryResponse = array();
// set our AccountSid and AuthToken - from www.twilio.com/user/account
$AccountSid = "";
$AuthToken = "";
// ini a new Twilio Rest Client
$objConnection = new Services_Twilio($AccountSid, $AuthToken);
// Send a new outgoinging SMS by POSTing to the SMS resource
$bSuccess = $objConnection->account->sms_messages->create(
$strFromNumber, // number we are sending from
$strToNumber, // number we are sending to
$strMsg // the sms body
);
$aryResponse["SentMsg"] = $strMsg;
$aryResponse["Success"] = true;
echo json_encode($aryResponse);
?>