使用php问题代理推送通知

前端之家收集整理的这篇文章主要介绍了使用php问题代理推送通知前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在我的应用程序中启用了推送通知,添加了构建提示,在play开发者控制台上注册了api,在我的服务器上创建并加载了Apple证书.当我在设备上测试应用程序时,它成功注册了推送通知.但是我的问题是尝试实际发送推送通知.我希望它通过 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','device' => 'cn1-ios-XXXXXXXXXXXXXXXXXXXXXXXX','email' =>    
'kyri88@gmail.com','auth' => 'XXXXXXXXXXX','body' => 'EAT MY BALLS'));
 $opts = array('http' =>
array(
'method' => 'POST','content' => $args
) );
$context = stream_context_create($opts);
$response =   
file_get_contents("https://push.codenameone.com/push/push",$context);

die(json_encode($response));

 ?>

猜你在找的PHP相关文章