php发送推送,从PHP通过pushwoosh发送推送通知

我正在尝试通过woosh发送推送通知,如下所示:

有人帮助我如何从此代码在设备上发送推送通知

函数pwCall(

‘createMessage’,数组(

'application' => PW_APPLICATION,

'auth' => PW_AUTH,

"devices" => PW_DEVICETOKEN,

'notifications' => array(

'send_date' =>'now', //gmdate('d-m-Y H:i', strtotime('2014-04-07 20:35')),

'content' => 'my custom notification testing ',

'link' => 'http://pushwoosh.com/',

'content' => array("en" => "English","ru" =>"Русский","de"=>"Deutsch")

),

'page_id' => 16863,

'link' => 'http://google.com',

'data' => array( 'custom' => 'json data' ),

)

);

我收到诸如

数组([status_code] => 210 [status_message] =>无法解析日期[response] =>)

解决方法:

>通知应该是JSON表示法中的对象数组.在PHP中,它将是数组数组.这是因为您可以在一个请求中创建多个通知.

通知的最终JSON字段:

“通知”:[{…通知属性…},{…第二个通知属性…},…]

>请求中只有3个根参数:application(OR applications_group),auth和通知.其他参数是通知参数,不是请求参数.

最后,您的PHP调用应如下所示:

pwCall("createMessage", array(

"auth" => PW_AUTH,

"application" => PW_APPLICATION,

"notifications" => array(

array(

"send_date" => "now",

"content" => array("en" => "English", "ru" =>"Русский", "de"=>"Deutsch"),

"link" => "http://pushwoosh.com/",

"page_id" => 16863,

"devices" => array( PW_DEVICETOKEN ),

"data" => array( "custom" => "json data" )

)

)

));

send_date和content以外的所有通知字段都是可选的,可以省略

标签:push-notification,oauth-2-0,iphone,php,pushwoosh

来源: https://codeday.me/bug/20191121/2054965.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值