こんにちは、PHP 経由で FTP-Hoster square7.ch 経由でプッシュ通知を送信しようとしていますが、常にいくつかのエラーが発生します。証明書はサーバー上にあります。誰でも私を助けることができますか?
PHPコードは次のとおりです。
<?php
$streamContext= stream_context_create();
stream_context_set_option($streamContext , 'ssl','local_cert' , 'TestPushApp.pem');
//stream_context_set_option($streamContext , 'ssl' , 'passphrase','password');
$socketClient = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195',$error,$errorString,60,STREAM_CLIENT_CONNECT,$streamContext);
$payload['aps']= array('alert' => 'Erste Push Nachricht ueber PHP','sound' => 'default','badge' => '20');
$payload= json_encode($payload);
echo $payload;
$deviceToken = str_replace(' ','','XXXXXXXXXXXXXXXXXX');
$message= pack('CnH*',0,32,$devicetoken);
$message= $message . pack ('n',strlen($payload));
$message= $messgae . $payload;
fwrite($socketClient,$message);
fclose($socketClient);
?>
エラーメッセージは次のとおりです。
Warning: stream_socket_client() [function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure in /users/michaellll/www/push.php on line 5
Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /users/michaellll/www/push.php on line 5
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /users/michaellll/www/push.php on line 5
{"aps":{"alert":"Erste Push Nachricht ueber PHP","sound":"default","badge":"20"}}
Warning: fwrite() expects parameter 1 to be resource, boolean given in /users/michaellll/www/push.php on line 13
Warning: fclose() expects parameter 1 to be resource, boolean given in /users/michaellll/www/push.php on line 14