According to PHP documentation for predefined constants, using STREAM_CLIENT_PERSISTENT with an APNS connection should support an active connection between page loads. This is a requirement for an APNS connection because it WILL throttles you because it considers any disconnection after sending a payload a potential denial of service attack.
- , , , , APNS- PHP. PHPXMLRPC, .
<?php
include '../vendors/xmlrpc.inc';
$hostName = 'localhost';
$rpcPath = '';
$port = 7077;
if($_GET['action'] == 'provisioning')
{
$echoString = new xmlrpcmsg(
'provision',
array(
php_xmlrpc_encode('appid'),
php_xmlrpc_encode('/path/to/certificate.pem'),
php_xmlrpc_encode('sandbox'),
php_xmlrpc_encode(100)
)
);
$continue = TRUE;
}
if($_GET['action'] == 'notify')
{
$echoString = new xmlrpcmsg(
'notify',
array(
php_xmlrpc_encode('paparazzme'),
php_xmlrpc_encode(array('6bcda...', '7c008...')),
php_xmlrpc_encode(array(array("aps" => array("alert" => "Hello User 1" )), array("aps" => array("alert" => "Hello User 2" ))))
)
);
$continue = TRUE;
}
if($continue == true)
{
$client = new xmlrpc_client($rpcPath, $hostName, $port);
$client->setDebug(2);
$response = &$client->send($echoString);
if (! $response->faultCode())
print "\nReturned string is: " . php_xmlrpc_decode($response->value()) . "\n";
else
print "An error occurred: \nCode: " . $response->faultCode() . " Reason: '" . htmlspecialchars($response->faultString()) . "'\n";
}
?>
: APNS iPhone iTouch
, , - , iPhone, , , .
, Uban Airship, 250 000 APN Server , API, .