PAMI\Message\Action\VGSMSMSTxAction::setTo PHP Method

setTo() public method

Sets CellPhone Number . Mandatory
public setTo ( string $target ) : void
$target string phone to send SMS to. Sign + and Countr code is needed in some countries.
return void
    public function setTo($target)
    {
        $this->setKey('To', $target);
    }

Usage Example

Beispiel #1
0
// Code STARTS.
////////////////////////////////////////////////////////////////////////////////
error_reporting(E_ALL);
ini_set('display_errors', 1);
try {
    $options = array('host' => $argv[1], 'port' => $argv[2], 'username' => $argv[3], 'secret' => $argv[4], 'connect_timeout' => 60, 'read_timeout' => 60);
    $a = new ClientImpl($options);
    $a->registerEventListener(new A());
    $a->open();
    // SMS
    $sms = new VGSMSMSTxAction();
    $sms->setContentType('text/plain; charset=ASCII');
    $msg = $argv[5];
    $phone = $argv[6];
    $sms->setContent($msg);
    $sms->setTo($phone);
    // SMS multipart MSG - This is used to send 1 big message splitted in several parts, up to 255 messages
    if ($argv[7] == 1) {
        $sms->setConcatRefId('58');
        $sms->setConcatTotalMsg('2');
        $sms->setConcatSeqNum('1');
        $a->send($sms);
        $sms->setContent('---Testing Multipart message ');
        $sms->setTo($phone);
        $sms->setConcatRefId('58');
        $sms->setConcatTotalMsg('2');
        $sms->setConcatSeqNum('2');
    }
    $a->send($sms);
    $time = time();
    while (true) {