PHP code example of jblond / aspsms
1. Go to this page and download the library: Download jblond/aspsms 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/ */
jblond / aspsms example snippets
use jblond\aspsms\Endpoint;
Dotenv::createImmutable(__DIR__ . '/../');
$dotenv->load();
$endpoint = new Endpoint();
$endpoint->setCredentials($_ENV['KEY'], $_ENV['PASSWORD'], $_ENV['SENDER']);
print_r($endpoint->getCredits());
var_dump($endpoint->sendSMS('Hello You! :)', ['+49555666777'], '2021-06-30T15:20:00+02:00'));
echo '<pre>';
print_r($endpoint->getTrafficStat());
echo '</pre>';
echo '<pre>';
print_r($endpoint->getSendingStat(2021, 6, 1));
echo '</pre>';
// get failed SMS
echo '<pre>';
$report = $endpoint->getSendingStat(date("Y", strtotime("Last month")), date("m", strtotime("Last month")));
foreach ($report as $item){
if($item['dst'] === 0 || $item['msisdn'] === ''){
continue;
}
print_r($item)
}
echo '</pre>';
echo '<pre>';
print_r($endpoint->getStats());
echo '</pre>';
echo '<pre>';
print_r($endpoint->getPhoneNumbers());
echo '<pre>';
$timestamp = date("c", strtotime("+30 seconds"))