PHP code example of comsolit / imasys-php

1. Go to this page and download the library: Download comsolit/imasys-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/ */

    

comsolit / imasys-php example snippets


$credentials = new Credentials('<YOUR_IMASYS_USER_ID>', '<YOUR_IMASYS_PASSWORD>');

$portalServers = PortalServers::fetchPortalServers($config['host'], $credentials);

$connection = new Connection($credentials, $portalServers);

$sendMessageRequest = new SendMessageRequest('<THE MESSAGE>', '<PHONE_NUMBER>', '<ORIGINATOR_NAME>');
$sendMessageResponse = $connection->send($sendMessageRequest);

sleep(10);
$batchStatusRequest = new BatchStatusRequest($sendMessageResponse->getBatchId());
$batchStatusResponse = $connection->send($batchStatusRequest);

foreach ($batchStatusResponse->getBatch()->getMessages() as $message) {
    print_r($message->getStatus());
}