ios - APNS with PHP giving failed to enable crypto error -
i trying send ios push notifications using following php code.
i'm not sure if syntax or logical error. have tried regenerating .pem, checking ports, , checking file permissions. it's fine. i'm not quite sure causing this. running on app engine. might why i'm not sure. know others have done on appreciated.
$ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', 'dev.pem'); $fp = stream_socket_client( 'ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, stream_client_connect|stream_client_persistent, $ctx); if (!$fp) { //handle error } $body['aps'] = array( 'alert' => $data["message"], 'sound' => 'default' ); $body["postid"] = $data["postid"]; $body["groupid"] = $data["groupid"]; $body["type"] = $data["type"]; $payload = json_encode($body); foreach ($registrationids $registrationid) { $msg = chr(0) . pack('n', 32) . pack('h*', $registrationid) . pack('n', strlen($payload)) . $payload; $result = fwrite($fp, $msg, strlen($msg)); } fclose($fp);
i keep getting errors :
php warning: stream_socket_client(): failed enable crypto php warning: stream_socket_client(): unable connect ssl://gateway.sandbox.push.apple.com:2195 (unknown error)
i have same problem , sad found out google app engine not support ssl://
or tls://
stream transporters.
you can find on page: https://cloud.google.com/appengine/docs/php/runtime
Comments
Post a Comment