Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blackberry中的推送通知_Blackberry - Fatal编程技术网

Blackberry中的推送通知

Blackberry中的推送通知,blackberry,Blackberry,您好,我想在blackberry中获得推送通知。我已经在Google上搜索了答案,并获得了推送服务指南。我阅读了本指南。本指南没有提供客户端应用程序的任何代码信息。它讨论推送服务器sdk及其安装,但没有给出如何编写客户端代码以获得推送通知的任何想法。那么有没有提供推送通知概念的示例代码呢 感谢您提供客户端代码,请参阅此链接 将其用作服务器端代码- <?php ini_set('display_errors','1'); error_reporting(E_ALL); // APP ID

您好,我想在blackberry中获得推送通知。我已经在Google上搜索了答案,并获得了推送服务指南。我阅读了本指南。本指南没有提供客户端应用程序的任何代码信息。它讨论推送服务器sdk及其安装,但没有给出如何编写客户端代码以获得推送通知的任何想法。那么有没有提供推送通知概念的示例代码呢


感谢您提供客户端代码,请参阅此链接

将其用作服务器端代码-

<?php
ini_set('display_errors','1');
error_reporting(E_ALL);

// APP ID provided by RIM
$appid = '';
// Password provided by RIM
$password = '';

//Deliver before timestamp
$deliverbefore = gmdate('Y-m-d\TH:i:s\Z', strtotime('+15 minutes'));

//An array of address must be in PIN format or "push_all"
$addresstosendto[] = 'push_all';

$addresses = '';
foreach ($addresstosendto as $value) {
$addresses .= '<address address-value="' . $value . '"/>';
}

// create a new cURL resource
$err = false;
$ch = curl_init();
$messageid = microtime(true);

$data = '--mPsbVQo0a68eIL3OAxnm'. "\r\n" .
'Content-Type: application/xml; charset=UTF-8' . "\r\n\r\n" .
'<?xml version="1.0"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd">
<pap>
<push-message push-id="' . $messageid . '" deliver-before-timestamp="' . $deliverbefore . '" source-reference="' . $appid . '">'
. $addresses .
'<quality-of-service delivery-method="confirmed"/>
</push-message>
</pap>' . "\r\n" .
'--mPsbVQo0a68eIL3OAxnm' . "\r\n" .
'Content-Type: text/plain' . "\r\n" .
'Push-Message-ID: ' . $messageid . "\r\n\r\n" .
stripslashes('This is my message') . "\r\n" .
'--mPsbVQo0a68eIL3OAxnm--' . "\n\r";

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://pushapi.eval.blackberry.com/mss/PD_pushRequest");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Hallgren Networks BB Push Server/1.0");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $appid . ':' . $password);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: multipart/related; boundary=mPsbVQo0a68eIL3OAxnm; type=application/xml", "Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2", "Connection: keep-alive"));

// grab URL and pass it to the browser
echo $xmldata = curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);

//Start parsing response into XML data that we can read and output
$p = xml_parser_create();
xml_parse_into_struct($p, $xmldata, $vals);
$errorcode = xml_get_error_code($p);
if ($errorcode > 0) {
echo xml_error_string($errorcode);
$err = true;
}
xml_parser_free($p);

echo 'Our PUSH-ID: ' . $messageid . "<br \>\n";
if (!$err && $vals[1]['tag'] == 'PUSH-RESPONSE') {
echo 'PUSH-ID: ' . $vals[1]['attributes']['PUSH-ID'] . "<br \>\n";
echo 'REPLY-TIME: ' . $vals[1]['attributes']['REPLY-TIME'] . "<br \>\n";
echo 'Response CODE: ' . $vals[2]['attributes']['CODE'] . "<br \>\n";
echo 'Response DESC: ' . $vals[2]['attributes']['DESC'] . "<br \> \n";
} else {
echo '<p>An error has occured</p>' . "\n";
echo 'Error CODE: ' . $vals[1]['attributes']['CODE'] . "<br \>\n";
echo 'Error DESC: ' . $vals[1]['attributes']['DESC'] . "<br \>\n";
}


?>
0){
echo xml\u error\u字符串($errorcode);
$err=true;
}
无xml解析器($p);
回显“我们的推送ID:”$messageid。“\n”;
如果(!$err&&$vals[1]['tag']=='PUSH-RESPONSE'){
回显'PUSH-ID:'。$vals[1]['attributes']['PUSH-ID']。“\n”;
回显“回复时间:”.$VAL[1]['attributes']['REPLY-TIME']。“\n”;
回显“响应代码:”.$VAL[2]['attributes']['CODE'].“\n”;
回显'Response DESC:'.$vals[2]['attributes']['DESC']。“\n”;
}否则{
回显“发生错误”

。“\n”; 回显“错误代码:”。$VAL[1]['attributes']['CODE'].“\n”; echo“Error DESC:”.$vals[1]['attributes']['DESC']。“\n”; } ?>
有关客户端代码,请参阅此链接

将其用作服务器端代码-

<?php
ini_set('display_errors','1');
error_reporting(E_ALL);

// APP ID provided by RIM
$appid = '';
// Password provided by RIM
$password = '';

//Deliver before timestamp
$deliverbefore = gmdate('Y-m-d\TH:i:s\Z', strtotime('+15 minutes'));

//An array of address must be in PIN format or "push_all"
$addresstosendto[] = 'push_all';

$addresses = '';
foreach ($addresstosendto as $value) {
$addresses .= '<address address-value="' . $value . '"/>';
}

// create a new cURL resource
$err = false;
$ch = curl_init();
$messageid = microtime(true);

$data = '--mPsbVQo0a68eIL3OAxnm'. "\r\n" .
'Content-Type: application/xml; charset=UTF-8' . "\r\n\r\n" .
'<?xml version="1.0"?>
<!DOCTYPE pap PUBLIC "-//WAPFORUM//DTD PAP 2.1//EN" "http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd">
<pap>
<push-message push-id="' . $messageid . '" deliver-before-timestamp="' . $deliverbefore . '" source-reference="' . $appid . '">'
. $addresses .
'<quality-of-service delivery-method="confirmed"/>
</push-message>
</pap>' . "\r\n" .
'--mPsbVQo0a68eIL3OAxnm' . "\r\n" .
'Content-Type: text/plain' . "\r\n" .
'Push-Message-ID: ' . $messageid . "\r\n\r\n" .
stripslashes('This is my message') . "\r\n" .
'--mPsbVQo0a68eIL3OAxnm--' . "\n\r";

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://pushapi.eval.blackberry.com/mss/PD_pushRequest");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Hallgren Networks BB Push Server/1.0");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $appid . ':' . $password);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: multipart/related; boundary=mPsbVQo0a68eIL3OAxnm; type=application/xml", "Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2", "Connection: keep-alive"));

// grab URL and pass it to the browser
echo $xmldata = curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);

//Start parsing response into XML data that we can read and output
$p = xml_parser_create();
xml_parse_into_struct($p, $xmldata, $vals);
$errorcode = xml_get_error_code($p);
if ($errorcode > 0) {
echo xml_error_string($errorcode);
$err = true;
}
xml_parser_free($p);

echo 'Our PUSH-ID: ' . $messageid . "<br \>\n";
if (!$err && $vals[1]['tag'] == 'PUSH-RESPONSE') {
echo 'PUSH-ID: ' . $vals[1]['attributes']['PUSH-ID'] . "<br \>\n";
echo 'REPLY-TIME: ' . $vals[1]['attributes']['REPLY-TIME'] . "<br \>\n";
echo 'Response CODE: ' . $vals[2]['attributes']['CODE'] . "<br \>\n";
echo 'Response DESC: ' . $vals[2]['attributes']['DESC'] . "<br \> \n";
} else {
echo '<p>An error has occured</p>' . "\n";
echo 'Error CODE: ' . $vals[1]['attributes']['CODE'] . "<br \>\n";
echo 'Error DESC: ' . $vals[1]['attributes']['DESC'] . "<br \>\n";
}


?>
0){
echo xml\u error\u字符串($errorcode);
$err=true;
}
无xml解析器($p);
回显“我们的推送ID:”$messageid。“\n”;
如果(!$err&&$vals[1]['tag']=='PUSH-RESPONSE'){
回显'PUSH-ID:'。$vals[1]['attributes']['PUSH-ID']。“\n”;
回显“回复时间:”.$VAL[1]['attributes']['REPLY-TIME']。“\n”;
回显“响应代码:”.$VAL[2]['attributes']['CODE'].“\n”;
回显'Response DESC:'.$vals[2]['attributes']['DESC']。“\n”;
}否则{
回显“发生错误”

。“\n”; 回显“错误代码:”。$VAL[1]['attributes']['CODE'].“\n”; echo“Error DESC:”.$vals[1]['attributes']['DESC']。“\n”; } ?>
您在BlackBerryes中尝试过城市飞艇推送通知吗?我见过城市飞艇。它不免费提供此服务。客户端代码示例参考您在BlackBerryes中尝试过城市飞艇推送通知吗?我见过城市飞艇。它不免费提供此服务。客户端代码示例参考如何在没有应用程序id的情况下测试推送通知。在测试eval URL上的推送通知并为生产请求新的应用程序id后,您无法在没有应用程序id的情况下测试推送通知。从评估模式更改为生产模式时,我的代码中的评估URL和生产URL是否有更改。是,您必须更改url。将评估url更改为新的生产url。如何在没有应用程序id的情况下测试推送通知。在测试评估url上的推送通知并为生产请求新的应用程序id后,您无法在没有应用程序id的情况下测试推送通知。从评估模式更改为生产模式时,我的代码中的评估url和生产url是否有更改。是的,您必须更改url。将评估url更改为新的生产url。