TWILIO SMS VERIFICATION
Last updated
Last updated
require __DIR__ . '/vendor/autoload.php';require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/autoload.php';
session_start();
use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
$account_sid = 'ACae07792961ca8cef99465b15e8c02a6c';
$auth_token = '1e2ee15327e5db8acfcfded0d985d784';
// In production, these should be environment variables. E.g.:
// $auth_token = $_ENV["TWILIO_AUTH_TOKEN"]
// Generate OTP
$OTP = mt_rand(100000, 999999);
$_SESSION['OTP'] = $OTP;
// A Twilio number you own with SMS capabilities
$twilio_number = "+15075955903";
$client = new Client($account_sid, $auth_token);
$client->messages->create(
// Where to send a text message (your cell phone?)
'+60176928902',
array(
'from' => $twilio_number,
'body' => $OTP
)
);