src/Sms.php
public function createSend($sender='', $messages=array(), $scheduledate='')
    {
        $message_sender = array();
        $index = 0;

        $url = $this->_setEnvironment.'wcf/Service.svc/rest/CreateSend';

        if(is_array($messages)) {
            foreach($messages as $mobile => $message){
                $message_sender[$index]['Mobile'] = $mobile;
                $message_sender[$index]['Text'] = $message;
                $index++;
            }
        }

        $json = array(
            'UserName'      => $this->user,
            'Password'      => $this->password,
            'Sender'        => $sender,
            'Messages'      => $message_sender,
            'ScheduleDate'  => $scheduledate,
        );

        try {
            $response = $this->client->post($url,[
                    'headers' => [ 'Content-Type' => 'application/json','Accept' => 'application/json' ],
                    'body' => json_encode($json)
                ]
            );

            $result = json_decode($response->getBody()->getContents(), true);
            $result['Status'] = $response->getStatusCode();
            $result =json_decode(json_encode($result));
        } catch (RequestException $e) {
            $result = $this->StatusCodeHandling($e);
        }

        return $result;
    }
public function createSend($sender='', $messages=array(), $scheduledate='')
    {
        $message_sender = array();
        $index = 0;

        $url = $this->_setEnvironment.'wcf/Service.svc/rest/CreateSend';

        if(is_array($messages)) {
            foreach($messages as $mobile => $message){
                $message_sender[$index]['Mobile'] = $mobile;
                $message_sender[$index]['Text'] = $message;
                $index++;
            }
        }

        $json = array(
            'UserName'      => $this->user,
            'Password'      => $this->password,
            'Sender'        => $sender,
            'Messages'      => $message_sender,
            'ScheduleDate'  => $scheduledate,
        );

        try {
            $response = $this->client->post($url,[
                    'headers' => [ 'Content-Type' => 'application/json','Accept' => 'application/json' ],
                    'body' => json_encode($json)
                ]
            );

            $result = json_decode($response->getBody()->getContents(), true);
            $result['Status'] = $response->getStatusCode();
            $result =json_decode(json_encode($result));
        } catch (RequestException $e) {
            $result = $this->StatusCodeHandling($e);
        }

        return $result;
    }
public function createSend ( $ sender = '' , $ messages = array ( ) , $ scheduledate = '' ) { $ message_sender = array ( ) ; $ index = 0 ; $ url = $ this -> _setEnvironment . 'wcf/Service.svc/rest/CreateSend' ; if ( is_array ( $ messages ) ) { foreach ( $ messages as $ mobile => $ message ) { $ message_sender [ $ index ] [ 'Mobile' ] = $ mobile ; $ message_sender [ $ index ] [ 'Text' ] = $ message ; $ index ++ ; } } $ json = array ( 'UserName' => $ this -> user , 'Password' => $ this -> password , 'Sender' => $ sender , 'Messages' => $ message_sender , 'ScheduleDate' => $ scheduledate , ) ; try { $ response = $ this -> client -> post ( $ url , [ 'headers' => [ 'Content-Type' => 'application/json' , 'Accept' => 'application/json' ] , 'body' => json_encode ( $ json ) ] ) ; $ result = json_decode ( $ response -> getBody ( ) -> getContents ( ) , true ) ; $ result [ 'Status' ] = $ response -> getStatusCode ( ) ; $ result = json_decode ( json_encode ( $ result ) ) ; } catch ( RequestException $ e ) { $ result = $ this -> StatusCodeHandling ( $ e ) ; } return $ result ; }
This operation allows you to send 1 or more messages in a single call.
@param string $sender Message sender. If informed, it must be a maximum of 11 characters. If not reported, the API will use the user-defined sender.
@param array $messages With the messages to send.
@param string $scheduledate Optional. Date and time when you want the message to be delivered at destination.
@return object
This operation allows you to send 1 or more messages in a single call .