TeleSign-PHP-Class is a project mainly written in PHP, it's free.
PHP class to help you easily integrate TeleSign's phone number verification system
TeleSign provides phone number verification for your websites or web applications. This class is designed to help you easily integrate TeleSign's services.
Your Customer ID and Authenticaion ID can be found here.
<?php
// Include the class
require_once('class.telesign.php');
// Setup and instantiate the class
$config = array(
'customer_id' => 'YOUR CUSTOMER ID',
'authentication_id' => 'YOUR AUTHENTICATION ID',
);
$telesign = new Telesign($config);
// Get the calling code for the user's country
//--------------------------------------------
$calling_code = $telesign->get_calling_code('US');
// Generate a 4 digit PIN
//--------------------------------------------
$pin = $telesign->generate_pin(4);
// Clean a phone number
// (removes all non-numeric characters)
//--------------------------------------------
$phone_number = '555-555-1234';
$phone_number = $telesign->clean_number($phone_number);
// Send an SMS
//--------------------------------------------
$send_sms = $ts->request_sms($calling_code, $phone_number, $pin);
if( $send_sms == false ) {
// Error sending the SMS
} else {
// Success
}
// Call a phone number
//--------------------------------------------
$call_phone = $ts->request_call($calling_code, $phone_number, $pin);
if( $call_phone == false ) {
// Error calling phone number
} else {
// Success
}
// Validate a PIN that a user has submitted
//--------------------------------------------
$pin = $_POST['pin'];
$verified = $telesign->validate_pin($pin);
if( $verified ) {
// PIN is correct
} else {
// PIN is not correct
}
// Get any errors that were returned
//--------------------------------------------
foreach( $telesign->errors() as $error ) {
echo $error . '<br />';
}
?>
This plugin was created by Mike Everhart. You can find me around the web at:
So you found a bug? Hey, nobody's perfect, right?
Please use GitHub's Issue Tracker to submit a bug report.
Got an idea to make this plugin even better? Well, lucky for you, you have two choices!