Estibens Manchego
Posts: 0
Joined: Thu Sep 18, 2014 9:38 pm

Push notification REST service (using cURL and PHP) suddenly started timing out?

pre
$url = "https://api.appery.io/rest/push/msg";
$message = '{"payload":{"message" : "Mensaje desde WP", "badge" : 1}[, "filter" : {"channels":{"$in":[200]},"type":{"$in":["A"]}}][, "schedule": {"scheduledTime": 2014-09-26 11:00}]}';
$headers = array(
'X-Appery-Push-Master-Key: XXXXXXXXXXXXXXX',
'Content-type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $message);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
$result = curl_exec($ch);
print_r($result);
/pre

Response: {"code":"PNMN007","description":"Serialization error"}

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Push notification REST service (using cURL and PHP) suddenly started timing out?

Hi Estibens,

You send an incorrect request: http://devcenter.appery.io/documentat...

Square brackets here mean that this parameter is not obligatory, wile you send them as an incorrect array. You should just remove them from a variable code$message/code line.

Return to “Issues”