PHP code example of secgin / netgsm-sms

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

    

secgin / netgsm-sms example snippets


$config = Config::create([
    'serviceUrl' => 'https://api.netgsm.com.tr',
    'username' => '',
    'password' => '',
    'defaultMessageHeader' => ''
]);
$apiClient = new ApiClient($config);

$request = SendSms::create('5460000000', 'Deneme')
    ->add('5050000000', 'deneme 2');

$result = $apiClient->sendSms($request);
if ($result->isSuccess())
    echo 'Başarılı. jobid:'.$result->jobid;
else
    echo 'Hata! error code: ' . $result->getErrorCode() .' error message: ' . $result->getErrorMessage();