PHP code example of twizo / lib-api-php

1. Go to this page and download the library: Download twizo/lib-api-php 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/ */

    

twizo / lib-api-php example snippets




$twizo = Twizo\Api\Twizo::getInstance('43reFDSrewrfet425rtefdGDSGds54twegdsgHaFST2refwd', 'api-asia-01.twizo.com');
	

$verification = $twizo->createVerification('610123456789');
$verification->send();

try {
    $result = $twizo->getTokenResult($verification->getMessageId(), '12345');

    print 'Success' . PHP_EOL;
} catch (Verification\Exception $e) {
    print 'Failed: ' . $e->getMessage() . PHP_EOL;
} catch (Twizo\Api\Exception $e) {
    print 'Exception: ' . $e->getMessage() . PHP_EOL;
}

$sms = $twizo->createSms('test message body', '610123456789', 'sender');
$sms->sendSimple();