Answer the question
In order to leave comments, you need to log in
How to send PUSH to iOS from php?
I am looking for the best solution to send iOS push via PHP. I found only the development adobkin.com/2013/04/10/php-apn-php-rasshir-d... everyone is satisfied, but it is not very convenient to install it, and client administrators do not always undertake to install a certain module for php for security reasons. But the most important thing is that this solution allows you to send a push with 64 Russian characters. According to my guess, this is due to the conversion of Russian characters into Unicode sequences like \u2201 when building JSON, and at the time of writing this library, the push size was limited to 256 bytes.
The real question is, who uses what?
Answer the question
In order to leave comments, you need to log in
The most common sockets. Code excerpt:
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err,
$errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
$payload = json_encode($body);
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
fwrite($fp, $msg, strlen($msg));
fclose($fp);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question