BlackBerry BES推送例子代码(php)

时间:2022-11-01 18:55:14

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 options
curl_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 browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_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库简介,使用案例