Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // unique device url
- $deviceURL = 'http://sn1.notify.live.net/throttledthirdparty/01.00/AAEvDeBgje2pQLQH3cXfiGWFAgAAAAADAQAAAAQUZm52OjIzOEQ2NDJDRkI5MEVFMEQ';
- // tile data
- $imageURL = "/images/about-main.png";
- $count = rand(0,99);
- $title = "Push del server!";
- $text = "Pushata dal server";
- $page="/SecondPage.xaml?NavigatedFrom=ToastNotification";
- $headers = array("X-WindowsPhone-Target: token","X-NotificationClass: 1");
- $msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>".
- "<wp:Notification xmlns:wp=\"WPNotification\">".
- "<wp:Tile>".
- "<wp:BackgroundImage>".$imageURL."</wp:BackgroundImage>".
- "<wp:Count>".$count."</wp:Count>".
- "<wp:Title>".$title."</wp:Title>".
- "</wp:Tile>".
- "</wp:Notification>";
- // use Client URL Library
- $ch = curl_init();
- // set an options for a cURL transfer
- // look options here: http://www.php.net/manual/en/function.curl-setopt.php
- // and what are needed here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202970(v=vs.92).aspx
- curl_setopt($ch, CURLOPT_URL, $deviceURL);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_HEADER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER,$headers + array('Content-Type: text/xml','Accept: application/*'));
- curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
- // perform a cURL session
- curl_exec($ch);
- // close a cURL session
- curl_close($ch);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement