0

I have a user phone list. It is just a array type. For example,

$phone = array('13100998888', '13188888000');

Then I am trying to send a text to 2 phone at a time.

include "php_serial.class.php";     
$serial = new phpSerial;
        $serial->deviceSet("/dev/ttyACM7");
        $serial->deviceOpen();
        for($i = 0; $i < count($phone); $i++){
            $phone_sendto   = InvertNumbers('86'.$phone[$i]);
            $message        = hex2str($str);
            $mess           = "11000D91".$phone_sendto."000800".sprintf("%02X",strlen($message)/2).$message;

            $serial->sendMessage("at+cmgf=0".chr(13));
            $serial->sendMessage("at+cmgs=".sprintf("%d",strlen($mess)/2).chr(13));
            $serial->sendMessage('00'.$mess.chr(26));
        }
        $serial->deviceClose();

    function hex2str($str) {
            $hexstring=iconv("UTF-8", "UCS-2", $str);
            $str = '';
            for($i=0; $i<strlen($hexstring)/2; $i++){
                    $str .= sprintf("%02X",ord(substr($hexstring,$i*2+1,1)));
                    $str .= sprintf("%02X",ord(substr($hexstring,$i*2,1)));
            }
            return $str;
    }
    function InvertNumbers($msisdn) {
            $len = strlen($msisdn);
            if ( 0 != fmod($len, 2) ) {
                    $msisdn .= "F";
                    $len = $len + 1;
            }

            for ($i=0; $i<$len; $i+=2) {
                    $t = $msisdn[$i];
                    $msisdn[$i] = $msisdn[$i+1];
                    $msisdn[$i+1] = $t;
            }
            return $msisdn;
    }

But was sent to only first phone number 13100998888.
Of course, there is no error.
How can I send a sms to multi user phone at a time? I am using php_serial.class.php

engel0088
  • 203
  • 3
  • 12
  • 2
    That would be up to your specific phone/device. SMS has never been a "multi recipient" system. The fact that some phones can send to multiple people is something they've done as an extra add-on, but they'll still be sending to one person at a time, just doing it repeatedly. – Marc B Jan 03 '14 at 17:43
  • Dear, thanks for your help. Then I have tried to send doing repeatedly above logic. But text is sent to only first phone and Text is broken.So, I have set as sleep(10). then text is sent to 2 phone, but still text is broken. – engel0088 Jan 04 '14 at 08:56

0 Answers0