1

ich das PHP-Skript unten verwendet Push-Benachrichtigungen zu senden und es funktioniert perfekt, wenn von meinem lokalen Computer gesendet „wamp Server“IOS Push-Benachrichtigungen funktioniert lokal, aber nicht auf Bluehost

mit Ich bin jetzt mit Bluehost Dienste und kaufte ein dedizierte IP und sie öffnete APNs Ports für mich 2195 und 2196

aber ich erhalte immer „APNS Verbindung fehlgeschlagen: 0“, während der gleiche Code ist perfekt lokal arbeiten

keine Hilfe Jungs? und danke im voraus.

stream_socket_client(): Fehlgeschlagen Krypto zu ermöglichen, in /public_html/simplepush.php

stream_socket_client(): Kann nicht ssl verbinden: //gateway.sandbox.push.apple.com: 2195 (Unbekannter Fehler) in /public_html/simplepush.php

Code:

<?php 




//$tHost = 'gateway.sandbox.push.apple.com'; 
$tHost = 'gateway.sandbox.push.apple.com'; 
$tPort = 2195; 
// Provide the Certificate and Key Data. 

$tCert = 'Key.pem'; 
$tPassphrase = 'mypasssss'; 
$tToken = "5d0897edddb84f38b951109dce8b99b7a7c7446d57b78a154f057d47dd878ac2"; 

$tAlert = 'New news has been added'; 
$tBadge = 1; 
$tSound = 'default'; 
$tPayload = 'xxx'; 

$tBody['aps'] = array (
'alert' => $tAlert, 
'badge' => $tBadge, 
'sound' => $tSound, 
); 

$tBody ['payload'] = $tPayload; 
$tBody = json_encode ($tBody); 

$tContext = stream_context_create(); 
stream_context_set_option ($tContext, 'ssl', 'local_cert', $tCert); 
stream_context_set_option ($tContext, 'ssl', 'passphrase', $tPassphrase); 

// Open the Connection to the APNS Server. 
$tSocket = stream_socket_client ('ssl://'.$tHost.':'.$tPort, $error, $errstr, 30, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $tContext); 
// Check if we were able to open a socket. 
if (!$tSocket) 
exit ("APNS Connection Failed: $error $errstr" . PHP_EOL); 

// Build the Binary Notification. 
$tMsg = chr (0) . chr (0) . chr (32) . pack ('H*', $tToken) . pack ('n', strlen ($tBody)) . $tBody; 

// Send the Notification to the Server. 
$tResult = fwrite ($tSocket, $tMsg, strlen ($tMsg)); 
if ($tResult) 
echo 'Delivered Message to APNS' . PHP_EOL; 
else 
echo 'Could not Deliver Message to APNS' . PHP_EOL; 
// Close the Connection to the Server. 
fclose ($tSocket); 

?> 

Antwort

0

Jeder mit diesem Problem konfrontiert gehen und generieren eine neue neue .pem-Datei und alles wird funktionieren