Skip to content

Commit

Permalink
Updated with Latest API
Browse files Browse the repository at this point in the history
  • Loading branch information
rtraselbd authored Jan 11, 2024
1 parent 3aa4fc3 commit ceeaf8e
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/Provider/Mim.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Xenon\Multisms\Provider;


use Xenon\Multisms\Handler\XenonException;
use Xenon\Multisms\Sender;

Expand All @@ -23,19 +22,19 @@ public function __construct(Sender $sender)
*/
public function sendRequest(): array
{
$url = "https://mimsms.com.bd/smsAPI";
$url = "https://api.mimsms.com/api/SmsSending/SMS";
$number = $this->formatNumber($this->senderObject->getMobile());
$text = $this->senderObject->getMessage();
$config = $this->senderObject->getConfig();

$data = [
'sendsms' => '',
'apikey' => $config['apikey'],
'apitoken' => $config['apitoken'],
'from' => $config['senderid'],
'type' => 'sms',
'to' => $number,
'text' => $text
'sendsms' => '',
'Apikey' => $config['apikey'],
'UserName' => $config['apitoken'],
'SenderName' => $config['senderid'],
'TransactionType' => 'T',
'MobileNumber' => $number,
'Message' => $text,
];
$ch = curl_init(); // Initialize cURL
curl_setopt($ch, CURLOPT_URL, $url);
Expand All @@ -56,9 +55,9 @@ private function formatNumber($mobile): string
if (mb_substr($mobile, 0, 2) == '01') {
$number = $mobile;
} elseif (mb_substr($mobile, 0, 2) == '88') {
$number = mb_substr($mobile, 2);
$number = str_replace('88', '', $mobile);
} elseif (mb_substr($mobile, 0, 3) == '+88') {
$number = mb_substr($mobile, 3);
$number = str_replace('+88', '', $mobile);
}
return '88' . $number;
}
Expand Down Expand Up @@ -97,8 +96,8 @@ public function generateReport($result, $data): array
'response' => $result,
'provider' => self::class,
'send_time' => date('Y-m-d H:i:s'),
'mobile' => $data['to'],
'message' => $data['text']
'mobile' => $data['MobileNumber'],
'message' => $data['Message'],
];
}
}
}

0 comments on commit ceeaf8e

Please sign in to comment.