1. Go to this page and download the library: Download yiiman/mediana-sms 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/ */
yiiman / mediana-sms example snippets
$api = new Yiiman\MedianaSms\MedianaSMS();
$api->apiKey = 'Your SMS panel API key';
$creditResult = $api->getCredit();
if ($creditResult->isSuccess()) {
echo $creditResult->credit;//is Float
}else{
echo "Response has some errors:\n\n";
var_dump($creditResult->getError()->message);
}
$api = new Yiiman\MedianaSms\MedianaSMS();
$api->apiKey = 'Your SMS panel API key';
// < Initializing data >
{
$dataSms = new SendSMSRequest();
$dataSms->originator0 = $sms_line;
$dataSms->recipients0 = [$test_mobile_number];
$dataSms->message0 = 'this is test';
}
// </ Initializing data >
if ($dataSms->validate()) {
$sendResult = $api->send($dataSms);
if ($sendResult && $sendResult->bulk_id) {
$message_info = $api->getMessage($sendResult->bulk_id);
if ($message_info->isSuccess()) {
echo "Message info :\n\n";
echo '-- message:'.$message_info->message."\n";
echo '-- status:'.$message_info->status."\n";
echo '-- created at:'.$message_info->created_at."\n";
echo '-- type:'.$message_info->type."\n";
echo '-- confirm status:'.$message_info->confirm_state."\n";
echo '-- number:'.$message_info->number."\n";
echo '-- sent at:'.$message_info->sent_at."\n";
echo '-- cost:'.$message_info->cost."\n";
echo '-- payback cost:'.$message_info->payback_cost."\n";
echo '-- count of receivers:'.$message_info->recipients_count."\n";
echo '-- count of valid receivers:'.$message_info->valid_recipients_count."\n";
} else {
echo "Server returned some errors:\n\n";
var_dump($message_info->getError()->message);
}
}
} else {
echo "Your posted data has some errors:\n\n";
var_dump($dataSms->errors());
}
bash
php test.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.