Sent push-notification to winphone
<?php
$uri="{token}";
$title = "TEST";
$subtitle = "TEST";
$delay = 2;
$target = 'toast';
$msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
"<wp:Notification xmlns:wp=\"WPNotification\">" .
"<wp:Toast>" .
"<wp:Text1>".htmlspecialchars($title)."</wp:Text1>" .
"<wp:Text2>".htmlspecialchars($subtitle)."</wp:Text2>" .
"</wp:Toast>" .
"</wp:Notification>";
$sendedheaders = array(
"Content-Type: text/xml",
"Accept: application/*",
"X-NotificationClass: " . $delay
);
if($target != NULL) {
$sendedheaders[] = "X-WindowsPhone-Target:" . $target;
}
$req = curl_init();
curl_setopt($req, CURLOPT_HEADER, true);
curl_setopt($req, CURLOPT_HTTPHEADER,$sendedheaders);
curl_setopt($req, CURLOPT_POST, true);
curl_setopt($req, CURLOPT_POSTFIELDS, $msg);
curl_setopt($req, CURLOPT_URL, $uri);
curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($req);
curl_close($req);