protected function buildSendSmsPayload(array $data = array())
    {
        $xml = new \SimpleXMLElement(
            '<?xml version="1.0" encoding="ISO-8859-1"?>'.
            '<!DOCTYPE MESSAGE SYSTEM "http://127.0.0.1:80/psms/dtd/messagev12.dtd">'.
            '<MESSAGE VER="1.2"></MESSAGE>'
        );

        $user = $xml->addChild('USER');
        foreach (array('USERNAME', 'PASSWORD') as $key) {
            if (!isset($data[$key])) {
                continue;
            }

            $user->addAttribute($key, $data[$key]);
        }

        $sms = $xml->addChild('SMS');
        foreach (array('UDH', 'CODING', 'PROPERTY', 'ID', 'TEXT', 'DLR', 'VALIDITY', 'SEND_ON') as $key) {
            if (!isset($data[$key])) {
                continue;
            }

            if ('TEXT' === $key) {
                $sms->addAttribute($key, $this->encodeMessage($data[$key]));
            } else {
                $sms->addAttribute($key, $data[$key]);
            }
        }

        $address = $sms->addChild('ADDRESS');
        foreach (array('FROM', 'TO', 'SEQ', 'TAG') as $k) {
            if (isset($data[ $k ])) {
                $address->addAttribute($k, $data[ $k ]);
            }
        }

        return $xml->asXml();
    }
protected function buildSendSmsPayload(array $data = array())
    {
        $xml = new \SimpleXMLElement(
            '<?xml version="1.0" encoding="ISO-8859-1"?>'.
            '<!DOCTYPE MESSAGE SYSTEM "http://127.0.0.1:80/psms/dtd/messagev12.dtd">'.
            '<MESSAGE VER="1.2"></MESSAGE>'
        );

        $user = $xml->addChild('USER');
        foreach (array('USERNAME', 'PASSWORD') as $key) {
            if (!isset($data[$key])) {
                continue;
            }

            $user->addAttribute($key, $data[$key]);
        }

        $sms = $xml->addChild('SMS');
        foreach (array('UDH', 'CODING', 'PROPERTY', 'ID', 'TEXT', 'DLR', 'VALIDITY', 'SEND_ON') as $key) {
            if (!isset($data[$key])) {
                continue;
            }

            if ('TEXT' === $key) {
                $sms->addAttribute($key, $this->encodeMessage($data[$key]));
            } else {
                $sms->addAttribute($key, $data[$key]);
            }
        }

        $address = $sms->addChild('ADDRESS');
        foreach (array('FROM', 'TO', 'SEQ', 'TAG') as $k) {
            if (isset($data[ $k ])) {
                $address->addAttribute($k, $data[ $k ]);
            }
        }

        return $xml->asXml();
    }
protected function buildSendSmsPayload ( array $ data = array ( ) ) { $ xml = new \ SimpleXMLElement ( '<?xml version="1.0" encoding="ISO-8859-1"?>' . '<!DOCTYPE MESSAGE SYSTEM "http://127.0.0.1:80/psms/dtd/messagev12.dtd">' . '<MESSAGE VER="1.2"></MESSAGE>' ) ; $ user = $ xml -> addChild ( 'USER' ) ; foreach ( array ( 'USERNAME' , 'PASSWORD' ) as $ key ) { if ( ! isset ( $ data [ $ key ] ) ) { continue ; } $ user -> addAttribute ( $ key , $ data [ $ key ] ) ; } $ sms = $ xml -> addChild ( 'SMS' ) ; foreach ( array ( 'UDH' , 'CODING' , 'PROPERTY' , 'ID' , 'TEXT' , 'DLR' , 'VALIDITY' , 'SEND_ON' ) as $ key ) { if ( ! isset ( $ data [ $ key ] ) ) { continue ; } if ( 'TEXT' === $ key ) { $ sms -> addAttribute ( $ key , $ this -> encodeMessage ( $ data [ $ key ] ) ) ; } else { $ sms -> addAttribute ( $ key , $ data [ $ key ] ) ; } } $ address = $ sms -> addChild ( 'ADDRESS' ) ; foreach ( array ( 'FROM' , 'TO' , 'SEQ' , 'TAG' ) as $ k ) { if ( isset ( $ data [ $ k ] ) ) { $ address -> addAttribute ( $ k , $ data [ $ k ] ) ; } } return $ xml -> asXml ( ) ; }
Constructs valid XML for sending SMS-MT message
@param  array  $data
@return string
Constructs valid XML for sending SMS - MT message