<?php

function sendSms($sms,$number,$message){

    header('Content-Type: text/plain;charset=utf-8');

    /*
     * Sending one SMS (text) to many cell phone numbers. (1toN)
     * */
    /*
    $to_list = array('905559980448'); // array('38761233976', '00905304012530', '+905364257920');
    $message = 'Bosna i Hercegovina je država u jugoistočnom dijelu Evrope...';
    */

    $from = '';
    $validity_period = 61;
    $data_coding = 'UCS2';
    date_default_timezone_set('UTC');
    $date = mktime(0, 0, 0, 11, 5, 2011); // 5 November 2011
    $scheduled_delivery_time = date(DATE_ATOM, $date); // '2011-11-05T00:00:00+00:00'

    /* Send SMS at 2011-11-05 00:00+01:00, valid for 61 minute and with unicode support */
    // $response = $maradit->submit($to_list, $message, $from, $scheduled_delivery_time, $validity_period, $data_coding);

    /* Send SMS immediately, with default sender (from) and  24h validity period, using default GSM 3.38 alphabet */
    $response = $sms->submit($number, $message);

    /* Send SMS immediately, with default sender (from) and  24h validity period, with unicode support */
    //$response = $sms->submit($to_list, $message, null, null, null, 'UCS2');

    /*
     * Sending personalized SMS messages. (NtoN)
     * Send immediately, with default sender (from) and  24h validity period, using default GSM 3.38 alphabet.
     * */
    $envelop_list = array();
    //$envelop_list[] = new Envelop('38761233976', 'hello bosnia');
    $envelop_list[] = new Envelop('905559980448', 'hello turkey');

    // $response = $maradit->submitMulti($envelop_list, $from, $scheduled_delivery_time);
    $response = $sms->submitMulti($envelop_list);


    /* Check submit response */
    if($response->status){
        if($response->payload->Status->Code == 200){
            echo "Message is sent. Check your reports with SMS ID: " . $response->payload->MessageId;
        }
        else{
            echo "No client error but server responded with error: "
                . $response->payload->Status->Code  . "-" . $response->payload->Status->Description;
        }
    }
    else{
        echo "Client error: $response->error";
    }

}