1. Go to this page and download the library: Download osiomagency/osiosms-php 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/ */
osiomagency / osiosms-php example snippets
use OsioSms\OsioSms;
$osiosms = new OsioSms('your_api_token');
$response = $osiosms->mms()->send(
'+33612345678', // Recipient's phone number
'YourName', // Sender ID
'https://example.com/150.jpg', // URL of the media to be sent
'This is a test MMS message', // Optional message body
'2021-12-20 07:00' // Optional scheduled time in RFC3339 format
);
print_r($response);
$response = $osiosms->sms()->send(
'+33612345678', // Recipient's phone number
'YourName', // Sender ID
'plain', // Message type (e.g., 'plain' for regular SMS)
'This is a test SMS message', // Message body
'2021-12-20 07:00', // Optional scheduled time in RFC3339 format
'dlt_template_id' // Optional DLT template ID
);
print_r($response);
$response = $osiosms->sms()->sendCampaign(
'contact_list_id', // ID of the contact list
'YourName', // Sender ID
'plain', // Message type (e.g., 'plain' for regular SMS)
'This is a campaign SMS message', // Message body
'2021-12-20 07:00', // Optional scheduled time in RFC3339 format
'dlt_template_id' // Optional DLT template ID
);
print_r($response);
$response = $osiosms->voice()->send(
'+33612345678', // Recipient's phone number
'YourName', // Sender ID
'en-gb', // Language code (e.g., 'en-gb' for British English)
'female', // Gender ('male' or 'female')
'This is a test voice message', // Message to be spoken
'2021-12-20 07:00' // Optional scheduled time in RFC3339 format
);
print_r($response);
$response = $osiosms->whatsapp()->send(
'+33612345678', // Recipient's phone number
'YourName', // Sender ID
'This is a test WhatsApp message', // Message content
'https://example.com/150.jpg', // Optional media URL for attachment
'2021-12-20 07:00' // Optional scheduled time in RFC3339 format
);
print_r($response);
$response = $osiosms->viber()->send(
'+33612345678', // Recipient's phone number
'YourName', // Sender ID
'This is a test Viber message', // Message content
'https://via.placeholder.com/150.jpg', // Optional media URL for attachment
'2021-12-20 07:00' // Optional scheduled time in RFC3339 format
);
print_r($response);