src/whatsprot.class.php
public function sendGetCipherKeysFromUser($numbers, $replaceKey = false)
    {
        if (!is_array($numbers)) {
            $numbers = [$numbers];
        }

        $this->replaceKey = $replaceKey;
        $msgId = $this->nodeId['cipherKeys'] = $this->createIqId();

        $userNode = [];
        foreach ($numbers as $number) {
            $userNode[] = new ProtocolNode('user',
              [
                  'jid' => $this->getJID($number),
              ], null, null);
        }
        $keyNode = new ProtocolNode('key', null, $userNode, null);
        $node = new ProtocolNode('iq',
            [
                'id'    => $msgId,
                'xmlns' => 'encrypt',
                'type'  => 'get',
                'to'    => Constants::WHATSAPP_SERVER,
            ], [$keyNode], null);

        $this->sendNode($node);
        $this->waitForServer($msgId);
    }
public function sendGetCipherKeysFromUser($numbers, $replaceKey = false)
    {
        if (!is_array($numbers)) {
            $numbers = [$numbers];
        }

        $this->replaceKey = $replaceKey;
        $msgId = $this->nodeId['cipherKeys'] = $this->createIqId();

        $userNode = [];
        foreach ($numbers as $number) {
            $userNode[] = new ProtocolNode('user',
              [
                  'jid' => $this->getJID($number),
              ], null, null);
        }
        $keyNode = new ProtocolNode('key', null, $userNode, null);
        $node = new ProtocolNode('iq',
            [
                'id'    => $msgId,
                'xmlns' => 'encrypt',
                'type'  => 'get',
                'to'    => Constants::WHATSAPP_SERVER,
            ], [$keyNode], null);

        $this->sendNode($node);
        $this->waitForServer($msgId);
    }
public function sendGetCipherKeysFromUser ( $ numbers , $ replaceKey = false ) { if ( ! is_array ( $ numbers ) ) { $ numbers = [ $ numbers ] ; } $ this -> replaceKey = $ replaceKey ; $ msgId = $ this -> nodeId [ 'cipherKeys' ] = $ this -> createIqId ( ) ; $ userNode = [ ] ; foreach ( $ numbers as $ number ) { $ userNode [ ] = new ProtocolNode ( 'user' , [ 'jid' => $ this -> getJID ( $ number ) , ] , null , null ) ; } $ keyNode = new ProtocolNode ( 'key' , null , $ userNode , null ) ; $ node = new ProtocolNode ( 'iq' , [ 'id' => $ msgId , 'xmlns' => 'encrypt' , 'type' => 'get' , 'to' => Constants :: WHATSAPP_SERVER , ] , [ $ keyNode ] , null ) ; $ this -> sendNode ( $ node ) ; $ this -> waitForServer ( $ msgId ) ; }
Send a request to get cipher keys from an user.

@param $number
Phone number of the user you want to get the cipher keys.
Send a request to get cipher keys from an user .