代号一推送通知有 php 问题

Codename one push notifications with php issue

我在我的应用程序中启用了推送通知,添加了构建提示,在 Play 开发者控制台上注册了 api,在我的服务器上创建并加载了苹果证书。当我在设备上测试该应用程序时,它会成功注册推送通知。但是,我的问题在于尝试实际发送推送通知。我希望它通过 PHP 发送。我使用的代码直接取自开发人员指南。然而,这不起作用......是我的代码有问题还是我在启用推送通知过程中做错了什么。

<?php

include("config.php");

$args = http_build_query(array( 'certPassword' => 'XXXXXXXX', 'cert' 
=>   
'http://kyven.co.za/mibrand/certificate/XXXX.p12',
'production' => false,
'device' => null, 'packageName' => 'za.co.bonyelo.mibrand', 'email' 
 =>     
'kyri88@gmail.com', 'type' => 1,
'auth' => 'XXXXXXXXXXXXXXXXXXXXXXXXXX',
'body' => 'Test'));
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',   
'content'     
=> $args
) );
$context = stream_context_create($opts);
$response = file_get_contents("https://codename-    
one.appspot.com/sendPushMessage", false, $context);

die(json_encode($response));
?>

知道了。这是我使用的代码

<?php

include("config.php");

$args = http_build_query(array('token' => 'XXXXXXXXXXXXXXXXXXX',
'certPassword' => 'XXXXXXXX', 'cert' =>     
'http://XXXXXXX/XXXXX/XXXXX/Certificates.p12',
'production' => false,
'device' => 'cn1-ios-XXXXXXXXXXXXXXXXXXXXXXXX',
 'packageName' => 'za.co.bonyelo.mibrand', 'email' =>    
'kyri88@gmail.com', 'type' => 1,
'auth' => 'XXXXXXXXXXX',
'body' => 'EAT MY BALLS'));
 $opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',   
'content' => $args
) );
$context = stream_context_create($opts);
$response =   
file_get_contents("https://push.codenameone.com/push/push", false,   
$context);

die(json_encode($response));

 ?>