src/whatsprot.class.php
public function sendSetPrivacyBlockedList($blockedJids = [])
    {
        if (!is_array($blockedJids)) {
            $blockedJids = [$blockedJids];
        }

        $items = [];
        foreach ($blockedJids as $index => $jid) {
            $item = new ProtocolNode('item',
                [
                    'type'   => 'jid',
                    'value'  => $this->getJID($jid),
                    'action' => 'deny',
                    'order'  => $index + 1, //WhatsApp stream crashes on zero index
                ], null, null);
            $items[] = $item;
        }

        $child = new ProtocolNode('list',
            [
                'name' => 'default',
            ], $items, null);

        $child2 = new ProtocolNode('query', null, [$child], null);
        $node = new ProtocolNode('iq',
            [
                'id'    => $this->createIqId(),
                'xmlns' => 'jabber:iq:privacy',
                'type'  => 'set',
            ], [$child2], null);

        $this->sendNode($node);
    }
public function sendSetPrivacyBlockedList($blockedJids = [])
    {
        if (!is_array($blockedJids)) {
            $blockedJids = [$blockedJids];
        }

        $items = [];
        foreach ($blockedJids as $index => $jid) {
            $item = new ProtocolNode('item',
                [
                    'type'   => 'jid',
                    'value'  => $this->getJID($jid),
                    'action' => 'deny',
                    'order'  => $index + 1, //WhatsApp stream crashes on zero index
                ], null, null);
            $items[] = $item;
        }

        $child = new ProtocolNode('list',
            [
                'name' => 'default',
            ], $items, null);

        $child2 = new ProtocolNode('query', null, [$child], null);
        $node = new ProtocolNode('iq',
            [
                'id'    => $this->createIqId(),
                'xmlns' => 'jabber:iq:privacy',
                'type'  => 'set',
            ], [$child2], null);

        $this->sendNode($node);
    }
public function sendSetPrivacyBlockedList ( $ blockedJids = [ ] ) { if ( ! is_array ( $ blockedJids ) ) { $ blockedJids = [ $ blockedJids ] ; } $ items = [ ] ; foreach ( $ blockedJids as $ index => $ jid ) { $ item = new ProtocolNode ( 'item' , [ 'type' => 'jid' , 'value' => $ this -> getJID ( $ jid ) , 'action' => 'deny' , 'order' => $ index + 1 , //WhatsApp stream crashes on zero index ] , null , null ) ; $ items [ ] = $ item ; } $ child = new ProtocolNode ( 'list' , [ 'name' => 'default' , ] , $ items , null ) ; $ child2 = new ProtocolNode ( 'query' , null , [ $ child ] , null ) ; $ node = new ProtocolNode ( 'iq' , [ 'id' => $ this -> createIqId ( ) , 'xmlns' => 'jabber:iq:privacy' , 'type' => 'set' , ] , [ $ child2 ] , null ) ; $ this -> sendNode ( $ node ) ; }
Set the list of numbers you wish to block receiving from.

@param mixed $blockedJids One or more numbers to block messages from.
Set the list of numbers you wish to block receiving from .