PHP code example of gsmservice-pl / messaging-sdk-php
1. Go to this page and download the library: Download gsmservice-pl/messaging-sdk-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/ */
gsmservice-pl / messaging-sdk-php example snippets
declare(strict_types=1);
use Gsmservice\Gateway\Models\Components;
$sdk = Gateway\Client::builder()
->setSecurity(
'<YOUR API ACCESS TOKEN>'
)
->build();
$request = [
new Components\SmsMessage(
recipients: [
'+48999999999',
],
message: 'To jest treść wiadomości',
),
];
$response = $sdk->outgoing->sms->send(
request: $request
);
if ($response->messages !== null) {
// handle response
}
declare(strict_types=1);
use Gsmservice\Gateway\Models\Components;
$sdk = Gateway\Client::builder()
->setSecurity(
'<YOUR API ACCESS TOKEN>'
)
->build();
$request = [
new Components\MmsMessage(
recipients: [
'+48999999999',
],
attachments: [
'<file_body in base64 format>',
],
subject: 'To jest temat wiadomości',
message: 'To jest treść wiadomości',
),
];
$response = $sdk->outgoing->mms->send(
request: $request
);
if ($response->messages !== null) {
// handle response
}