Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
Using PHP and cURL to send a notification using Notification Service API
With the Notifications API you can enable Push messages for Qt applications. Notifications API consists of two major parts Client API and Service API. Client API is to be used on a device with Qt. It handles registration and message passing between device and Notifications Server. Notifications Service API is REST API that handles the communication between your service and Notifications Server.
See more information on http://developer.nokia.com/Resources/Library/Java/#!developers-guides/nokia-notifications.html
You can include the code below to your Web Page or run it directly from console, by saving the file as notification.php and running it “php notification.php”.
$serviceId = "<service id>";
$serviceSecret = "<service secret>";
$nid = urlencode("<notification id of the application>");
$url = "https://alpha.one.ovi.com/nnapi/1.0/nid/".$nid."/";
$args = '&payload=hello&ctype='.urlencode("text/plain");
$session = curl_init($url);
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $args);
curl_setopt($session, CURLOPT_HEADER, true);
curl_setopt($session, CURLOPT_RETURNTRANSFER, false);
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($session, CURLOPT_VERBOSE, true); //verbose
curl_setopt($session, CURLOPT_HEADER, true); //display headers
curl_setopt($session, CURLOPT_USERPWD, $serviceId.':'.$serviceSecret);