PHP code example of invokatis / sendotp

1. Go to this page and download the library: Download invokatis/sendotp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

invokatis / sendotp example snippets




/**
 * @desc Create a SendOTP\Client with your auth key.
 */
$client = new SendOTP\Client('<auth-key>');

/**
 * @desc Send and retrieve whether successful or not.
 */
$sent = $client->generate('9876543210', '91');

/**
 * @desc Verify an OTP entered by user.
 */
$ok = $client->verify($_POST['otp'], '9876543210', '91');
if ($ok) {
    // OTP verified successfully!
}