RIM提供的標準BES Push例子代碼是基於Java/Domino/ASP的。沒有php的官方例子代碼。
2013年更新:BES 10/BDS 10針對BlackBerry 10手機的企業推送:
// create a new cURL resource$ch = curl_init();$data = 'subject=' . $entityData->get('ticket_title') . '&id=' . $entityData->get('ticket_no') . '&content=' . $entityData->get('description') . '&status=' . $entityData->get('ticketstatus') . '&author=Jiang Yang&createdtime=2013 04 18';// set URL and other appropriate optionscurl_setopt($ch, CURLOPT_URL, "http://bes101.acmehq.springworks.info:9080/push?DESTINATION=user02@acmehq.springworks.info&PORT=MyApplicationID_ddemo&REQUESTURI=/");curl_setopt($ch, CURLOPT_HEADER, true);curl_setopt($ch, CURLOPT_USERAGENT, "BlackBerry Push Service SDK/1.0");curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $data);curl_setopt($ch, CURLOPT_VERBOSE, true);// grab URL and pass it to the browsercurl_exec($ch);// close cURL resource, and free up system resourcescurl_close($ch);
2011年,BES 5.0對BlackBerry OS 5/6/7的企業推送
,是基於參考1簡化而來的,可以通過BES emulator推送資料到BlackBerry Emulator上的用戶端程式ECL Sample client(用戶端代碼參考最後兩個連結)。
<html><head><title>Push Results</title></head><body><?php// create a new cURL resource$ch = curl_init();$data = 'NEXT_GROUP;Operations Team;NEW_CONTACT;Wang Bo 2011;Sr. Vice President, Operations;Office: 519 555-1111;Cell: 519 555-1222;Email: john.doe@email.xyz.com;BlackBerry: pin:1111111F;Prime Backup: John Flow;NEW_CONTACT;John Flow;Manager, Manufacturing Operations;Office: 519 555-2111;Cell: 519 555-2222;Email: john.flow@email.xyz.com;BlackBerry: pin:2222222F;Prime Backup: ;NEW_CONTACT;John Snow;Manager, Transportation Operations;Office: 519 555-3111;Cell: 519 555-3222;Email: john.snow@email.xyz.com;BlackBerry: pin:3333333F;Prime Backup: Julian;NEXT_GROUP;Support Team;NEW_CONTACT;Julian Migs;Team Planner;Office: 519 555-4111;Cell: 519 555-4222;Email: julian@email.xyz.com;Prime Backup: Ricky;NEW_CONTACT;Ricky Williams;Vice President, Plannning;Office: 519 555-5111;Cell: 519 555-5222;Email: ricky@email.xyz.com;NEW_CONTACT;Bubbles Devil;Feline Affairs Specialist;Office: 519 555-6111;Cell: 519 555-6222;Email: bubbles@email.xyz.com;NEW_CONTACT;Randy Whitt;Assistant Weekend Supervisor;Office: 519 555-7111;Cell: 519 555-7222;Email: randy@email.xyz.com;';// set URL and other appropriate optionscurl_setopt($ch, CURLOPT_URL, "http://localhost:8080/push?DESTINATION=2100000A&PORT=911&REQUESTURI=/");curl_setopt($ch, CURLOPT_HEADER, true);curl_setopt($ch, CURLOPT_USERAGENT, "BlackBerry Push Service SDK/1.0");curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $data);curl_setopt($ch, CURLOPT_VERBOSE, true);// grab URL and pass it to the browsercurl_exec($ch);// close cURL resource, and free up system resourcescurl_close($ch);?></body></html>
參考:
1)BES Push
http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/Push-API-sample-code-needed/td-p/468267
2)BIS Push
http://us.blackberry.com/devjournals/resources/journals/jan_2005/push_me.jsp#Download_The_Source
3)ECL Java Push例子: What Is - Sample applications demonstrating BlackBerry push technology: Emergency Contact List
To push an Emergency Contact List to a BlackBerry smartphone, configure a Browser Channel push with the Emergency Contact List. A test application has been created and can be referred to in this article:DB-00442.
4)BES推送應用執行個體示範與分析
5)PHP的cURL庫簡介,使用案例