PHP code example of aimedidierm / fdisms

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

    

aimedidierm / fdisms example snippets




imedidierm\FdiSms\SendSms;

$to = ""; // Receiver phone number
$message = "";  // Text message to be send
$senderId = ""; // Your User ID provided by FDI
$ref = "";  // Your unique message reference ID
$callbackUrl = "";  //Optional Delivery Report destination

try {
$apiUsername = "";  // Your API Username provided by FDI
$apiPassword = "";  // Your API Password provided by FDI
$smsSender = new SendSms($apiUsername, $apiPassword);

$response = $smsSender->sendSms($to, $message, $senderId, $ref, $callbackUrl);

if ($response['success']) {
return response()->json(['message' => 'SMS sent successfully']);
} else {
return response()->json(['message' => $response['message'], 500]);
}
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 500);
}