RIM提供的标准BES Push例子代码是基于Java/Domino/ASP的。没有php的官方例子代码。
这里给一个简单的php例子,是基于参考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 options curl_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 browser curl_exec($ch); // close cURL resource, and free up system resources curl_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 toa 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推送应用实例演示与分析