src/whatsprot.class.php
public function sendGroupsLeave($gjids)
    {
        $msgId = $this->nodeId['leavegroup'] = $this->createIqId();

        if (!is_array($gjids)) {
            $gjids = [$this->getJID($gjids)];
        }

        $nodes = [];
        foreach ($gjids as $gjid) {
            $nodes[] = new ProtocolNode('group',
                [
                    'id' => $this->getJID($gjid),
                ], null, null);
        }

        $leave = new ProtocolNode('leave',
            [
                'action' => 'delete',
            ], $nodes, null);

        $node = new ProtocolNode('iq',
            [
                'id'    => $msgId,
                'to'    => Constants::WHATSAPP_GROUP_SERVER,
                'type'  => 'set',
                'xmlns' => 'w:g2',
            ], [$leave], null);

        $this->sendNode($node);
    }
public function sendGroupsLeave($gjids)
    {
        $msgId = $this->nodeId['leavegroup'] = $this->createIqId();

        if (!is_array($gjids)) {
            $gjids = [$this->getJID($gjids)];
        }

        $nodes = [];
        foreach ($gjids as $gjid) {
            $nodes[] = new ProtocolNode('group',
                [
                    'id' => $this->getJID($gjid),
                ], null, null);
        }

        $leave = new ProtocolNode('leave',
            [
                'action' => 'delete',
            ], $nodes, null);

        $node = new ProtocolNode('iq',
            [
                'id'    => $msgId,
                'to'    => Constants::WHATSAPP_GROUP_SERVER,
                'type'  => 'set',
                'xmlns' => 'w:g2',
            ], [$leave], null);

        $this->sendNode($node);
    }
public function sendGroupsLeave ( $ gjids ) { $ msgId = $ this -> nodeId [ 'leavegroup' ] = $ this -> createIqId ( ) ; if ( ! is_array ( $ gjids ) ) { $ gjids = [ $ this -> getJID ( $ gjids ) ] ; } $ nodes = [ ] ; foreach ( $ gjids as $ gjid ) { $ nodes [ ] = new ProtocolNode ( 'group' , [ 'id' => $ this -> getJID ( $ gjid ) , ] , null , null ) ; } $ leave = new ProtocolNode ( 'leave' , [ 'action' => 'delete' , ] , $ nodes , null ) ; $ node = new ProtocolNode ( 'iq' , [ 'id' => $ msgId , 'to' => Constants :: WHATSAPP_GROUP_SERVER , 'type' => 'set' , 'xmlns' => 'w:g2' , ] , [ $ leave ] , null ) ; $ this -> sendNode ( $ node ) ; }
Leave a group chat.

@param mixed $gjids Group or group's ID(s)
Leave a group chat .