PHP code example of mrbase / smesg

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

    

mrbase / smesg example snippets

 php


 array(
    'user' => 'test',
    'password' => 'test....',
    'appnr' => '1212',
    'mediacode' => 'test',
    'price' => '0.00DK',
);

$transport = new Smesg\Adapter\PhpStreamAdapter();
$provider = new Smesg\Provider\UnwireProvider($transport, $config);

$provider->addMessage('mobile_number', 'message');
$response = $provider->send();
 php


$config = array(
    'user' => '',
    'password' => '',
    'appnr' => '',
    'mediacode' => '',
    'price' => '',
    'get_smsc' => false,
);
 php
$defaults = array(
    'operator' => null,
    'shortcode' => null,
    'mediacode' => null,
    'price' => array(
        'amount' => null,
        'currency' => null,
        'vat' => null,
    ),
    'content' => null,
);
 php

// ....
$provider = new Smesg\Provider\UnwireProvider($transport, $config);

$provider->setDefaults(array(
    'shortcode' => '1212',
    'mediacode' => 'test',
    'content' => 'this is the message send',
));

$provider->addMessage('mobile_number_1', null);
$provider->addMessage('mobile_number_2', null);
$provider->addMessage('mobile_number_3', null);
$response = $provider->send();