I need to send push messages from my web service to the windows phone. I am able to achieve this from console, however i need to do this using a php script
Code i have tried:
$url = 'https://api.parse.com/1/push';
$appId = 'xxx';
$restKey = 'xxx';
$push_payload = json_encode(array(
"where" => '"deviceType"=>"winrt"',
"data" => array(
"alert" => "This is the alert text."
)
));
$rest = curl_init();
curl_setopt($rest,CURLOPT_URL,$url);
curl_setopt($rest,CURLOPT_PORT,443);
curl_setopt($rest,CURLOPT_POST,1);
curl_setopt($rest,CURLOPT_POSTFIELDS,$push_payload);
curl_setopt($rest,CURLOPT_HTTPHEADER,
array("X-Parse-Application-Id: " . $appId,
"X-Parse-REST-API-Key: " . $restKey,
"Content-Type: application/json"));
$response = curl_exec($rest);
echo $response;
var_dump($response);
}
But on the dumping the response i get a boolean value:false and no notification appears on the phone.
Try this:
$push_payload = json_encode(array(
"where" => array("deviceType" => "winrt"),
"data" => array("alert" => "This is the alert text.")
));