src/Sms/Tww.php
public function send(array $data)
    {
        $phone = preg_replace("/[(,),\-,\s]/", "", $data['to']);
        $phone = preg_replace('/^' . preg_quote('+55', '/') . '/', '', $phone);

        $text      = self::sanitizeText($data['text']);
        $url       = 'http://webservices.twwwireless.com.br/reluzcap/wsreluzcap.asmx/EnviaSMS';
        $queryData = array_merge($this->credentials, ['Celular' => $phone, 'Mensagem' => $text]);

        if (isset($data['id'])) {
            $queryData['SeuNum'] = $data['id'];
        } else {
            $queryData['SeuNum'] = 0;
        }

        $options = [
            'http' => [
                'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
                'method'  => 'POST',
                'content' => http_build_query($queryData),
            ],
        ];
        $context = stream_context_create($options);

        return file_get_contents($url, false, $context);
    }
public function send(array $data)
    {
        $phone = preg_replace("/[(,),\-,\s]/", "", $data['to']);
        $phone = preg_replace('/^' . preg_quote('+55', '/') . '/', '', $phone);

        $text      = self::sanitizeText($data['text']);
        $url       = 'http://webservices.twwwireless.com.br/reluzcap/wsreluzcap.asmx/EnviaSMS';
        $queryData = array_merge($this->credentials, ['Celular' => $phone, 'Mensagem' => $text]);

        if (isset($data['id'])) {
            $queryData['SeuNum'] = $data['id'];
        } else {
            $queryData['SeuNum'] = 0;
        }

        $options = [
            'http' => [
                'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
                'method'  => 'POST',
                'content' => http_build_query($queryData),
            ],
        ];
        $context = stream_context_create($options);

        return file_get_contents($url, false, $context);
    }
public function send ( array $ data ) { $ phone = preg_replace ( "/[(,),\-,\s]/" , "" , $ data [ 'to' ] ) ; $ phone = preg_replace ( '/^' . preg_quote ( '+55' , '/' ) . '/' , '' , $ phone ) ; $ text = self :: sanitizeText ( $ data [ 'text' ] ) ; $ url = 'http://webservices.twwwireless.com.br/reluzcap/wsreluzcap.asmx/EnviaSMS' ; $ queryData = array_merge ( $ this -> credentials , [ 'Celular' => $ phone , 'Mensagem' => $ text ] ) ; if ( isset ( $ data [ 'id' ] ) ) { $ queryData [ 'SeuNum' ] = $ data [ 'id' ] ; } else { $ queryData [ 'SeuNum' ] = 0 ; } $ options = [ 'http' => [ 'header' => "Content-type: application/x-www-form-urlencoded\r\n" , 'method' => 'POST' , 'content' => http_build_query ( $ queryData ) , ] , ] ; $ context = stream_context_create ( $ options ) ; return file_get_contents ( $ url , false , $ context ) ; }
Send a sms using Tww API

@param array $data ['id', 'text', 'to'] Key-value array
* 'id'   - recipient unique identifier
* 'text' - message that will be sent
* 'to'     - number without country code,

@return bool|string
Send a sms using Tww API