PHP code example of fastsms / sdk

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

    

fastsms / sdk example snippets


$credits = $client->credits->balance; //return float val
echo number_format($credits, 2); //example show 1,000.00

...
use FastSMS\Model\Message;
...
// Init Message data
$data = [
    //set
    'destinationAddress' => 'Phone number or multiple numbers in array',
    //or
    'list' => 'Your contacts list',
    //or
    'group' => 'Your contacts group'

    'sourceAddress' => 'Your Source Address',
    'body' => 'Message Body', //Note: max 459 characters
    //optionals
    'scheduleDate' => time() + 7200, //now + 2h
    'validityPeriod' => 3600 * 6, //maximum 86400 = 24 hours
    'sourceTON' => 1, //The Type Of Number for the source address (1 for international, 5 for alphanumeric)
];
$result = $client->message->send($data);

...
use FastSMS\Model\Report;
...
// Init Report params
$data = [
    'reportType' => 'Messages',
    'from' => time() - 3600 * 24 * 30,
    'to' => time()
];
// Get report
$result = $client->report->get($data);