iphone - Sending Push notification through pushwoosh from php -
i trying send push notification through push woosh such :
is me how send push notification on device code
function pwcall(
'createmessage'
, array(
'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' ), ) );
i getting error such
array ( [status_code] => 210 [status_message] => cannot parse date [response] => )
notifications should array of objects in json notation. in php array of arrays. because can create multiple notifications in 1 request. final json notifications field:
"notifications":[{ ... notification properties... }, { ... second notification properties ... }, ...]
- there 3 root parameters in request: application(or applications_group), auth, , notifications. other parameters parameters of notification, not request.
finally php call should following:
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" ) ) ) ));
all notification's fields except of send_date , content optional , can omited
Comments
Post a Comment