push-notificationapple-push-notificationspushpassbookapns-php

Push for pass on Passbook


I try send push notification on Passbook by ApnsPHP library

$config['production'] = DOCROOT . '/my_cert.pm';
$config['entrust'] = DOCROOT . '/entrust_root_certification_authority_2048.pem';
$config['passphrase'] = '';
$token = $push_info->push_token;
$text = 'TEST';
$push = new ApnsPHP_Push(
    ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION, $config['production']
);
if ($config['passphrase'] <> '') {
    $push->setProviderCertificatePassphrase($config['passphrase']);
}
$push->setRootCertificationAuthority($config['entrust']);
$message = new ApnsPHP_Message();
$message->addRecipient($token);
$push->connect();
$message->setSound();
$message->setText($text);
$push->add($message);
$push->send();
$push->disconnect();
$aErrorQueue = $push->getErrors();
if (!empty($aErrorQueue)) {
    echo 'Error -  ' . print_r($aErrorQueue, true);
}

Output

Wed, 20 Mar 2019 11:01:16 +0000 ApnsPHP[6467]: INFO: Trying tls://gateway.push.apple.com:2195...
Wed, 20 Mar 2019 11:01:17 +0000 ApnsPHP[6467]: INFO: Connected to tls://gateway.push.apple.com:2195.
Wed, 20 Mar 2019 11:01:17 +0000 ApnsPHP[6467]: INFO: Sending messages queue, run #1: 1 message(s) left in queue.
Wed, 20 Mar 2019 11:01:17 +0000 ApnsPHP[6467]: STATUS: Sending message ID 1 [custom identifier: unset] (1/3): 87 bytes.
Wed, 20 Mar 2019 11:01:18 +0000 ApnsPHP[6467]: INFO: Disconnected.

But device didn't try push my server (all request write in log, he is empty).

I cant understand what wrong... some ideas?


Solution

  • The thing is that Apple has made a change in the export of certificates for signing. Now it has a simplified mechanic: the certificate bundle (pass cert and Apple certificate) is immediately exported to "*.pem"