public function apnsFeedback() {

        $feedback_tokens = array();

        if (!$this->existCertificate()) {
            return $feedback_tokens;
        }

        //connect to the APNS feedback servers
        $ctx = $this->composeStreamSocket();

        // Open a connection to the APNS server
        try {
            $apns = stream_socket_client($this->feedbackUrl, $errcode, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);

            //Read the data on the connection:
            while (!feof($apns)) {
                $data = fread($apns, 38);
                if (strlen($data)) {
                    $feedback_tokens['apnsFeedback'][] = unpack("N1timestamp/n1length/H*devtoken", $data);
                }
            }
            fclose($apns);

        } catch (\Exception $e) {
            //if stream socket can't be established, try again
            if ($this->canRetry()) {
                return $this->apnsFeedback();
            }

            $response = [
                'success' => false,
                'error' => 'APNS feedback connection problem: ' . $e->getMessage() . PHP_EOL
            ];

            $this->setFeedback(json_decode(json_encode($response)));

        } finally {
            $this->resetAttempts();
            return $feedback_tokens;
        }
    }
public function apnsFeedback() {

        $feedback_tokens = array();

        if (!$this->existCertificate()) {
            return $feedback_tokens;
        }

        //connect to the APNS feedback servers
        $ctx = $this->composeStreamSocket();

        // Open a connection to the APNS server
        try {
            $apns = stream_socket_client($this->feedbackUrl, $errcode, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);

            //Read the data on the connection:
            while (!feof($apns)) {
                $data = fread($apns, 38);
                if (strlen($data)) {
                    $feedback_tokens['apnsFeedback'][] = unpack("N1timestamp/n1length/H*devtoken", $data);
                }
            }
            fclose($apns);

        } catch (\Exception $e) {
            //if stream socket can't be established, try again
            if ($this->canRetry()) {
                return $this->apnsFeedback();
            }

            $response = [
                'success' => false,
                'error' => 'APNS feedback connection problem: ' . $e->getMessage() . PHP_EOL
            ];

            $this->setFeedback(json_decode(json_encode($response)));

        } finally {
            $this->resetAttempts();
            return $feedback_tokens;
        }
    }
public function apnsFeedback ( ) { $ feedback_tokens = array ( ) ; if ( ! $ this -> existCertificate ( ) ) { return $ feedback_tokens ; } //connect to the APNS feedback servers $ ctx = $ this -> composeStreamSocket ( ) ; // Open a connection to the APNS server try { $ apns = stream_socket_client ( $ this -> feedbackUrl , $ errcode , $ errstr , 60 , STREAM_CLIENT_CONNECT , $ ctx ) ; //Read the data on the connection: while ( ! feof ( $ apns ) ) { $ data = fread ( $ apns , 38 ) ; if ( strlen ( $ data ) ) { $ feedback_tokens [ 'apnsFeedback' ] [ ] = unpack ( "N1timestamp/n1length/H*devtoken" , $ data ) ; } } fclose ( $ apns ) ; } catch ( \ Exception $ e ) { //if stream socket can't be established, try again if ( $ this -> canRetry ( ) ) { return $ this -> apnsFeedback ( ) ; } $ response = [ 'success' => false , 'error' => 'APNS feedback connection problem: ' . $ e -> getMessage ( ) . PHP_EOL ] ; $ this -> setFeedback ( json_decode ( json_encode ( $ response ) ) ) ; } finally { $ this -> resetAttempts ( ) ; return $ feedback_tokens ; } }
Get the unregistered device tokens from the apns feedback.
Connect to apn server in order to collect the tokens of the apps which were removed from the device.

@return array
Get the unregistered device tokens from the apns feedback . Connect to apn server in order to collect the tokens of the apps which were removed from the device .