1
iOS Phonegap 앱에 푸시 알림 메시지를 보내는 간단한 스크립트가 있습니다.Apple 푸시 알림 - 텔넷으로 연결할 수 없습니다.
Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out)
내가 다음 시도 :
$payload['aps'] = array('alert' => 'This is the alert text', 'badge' => 1, 'sound' => 'default');
$payload = json_encode($payload);
$apnsHost = 'gateway.sandbox.push.apple.com';
$apnsPort = 2195;
$apnsCert = 'mountmercy/MountMercy-dev.pem';
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);
$deviceToken = "the_device_token";
$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $deviceToken)) . chr(0) . chr(strlen($payload)) . $payload;
fwrite($apns, $apnsMessage);
socket_close($apns);
fclose($apns);
echo "error is ".$error."<br />";
echo "errorString is ".$errorString."<br />";
내가 매우 일반적이고 일반적인 오류 얻을 : 여기있다
telnet gateway.sandbox.push.apple.com 2195
을하지만 난 응답을 얻을 :
Trying 17.149.34.189...
Trying 17.149.34.188...
Trying 17.149.34.187...
telnet: Unable to connect to remote host: Connection timed out
을
st를 다루는 많은 질문이 있습니다. eam_socket_client() 오류가 있지만 텔넷으로 연결할 수 없다는 사실은 다른 문제가 있음을 나타냅니다 ...