मैं अपने PHP लैरवेल ऐप में पुश नोटिफ़ का उपयोग करता हूं। मैंने एक पेम फ़ाइल बनाई और इसका परीक्षण किया। मेरे देव मशीन पर इसका उपयोग करते समय, यह सही ढंग से मोबाइल डिवाइस पर धक्का देता है। Failed to enable crypto
पुश अधिसूचना क्रिप्टो त्रुटि
मैं एक विशेष पीईएम फ़ाइल बनाने की आवश्यकता है, जबकि उत्पादन सर्वर पर किया जा रहा कार्य करें: जब मैं अपने उत्पादन सर्वर के लिए पूरी परियोजना धक्का, और pushnotif कॉल प्रारंभ करें, मैं त्रुटि मिलती है? और मैं के बारे में "उत्पादन प्रमाण पत्र" बात नहीं कर रहा मैं अभी भी परीक्षण के लिए सैंडबॉक्स उपयोग करने के लिए
<?php
namespace App\Helpers;
use Carbon\Carbon;
use Illuminate\Support\Facades\Config;
class PushNotificationHelper {
public function pushToResponder($deviceToken) {
// Set device token of mobile device and the passphrase for certification
$pushToken = $deviceToken;
$passphrase = Config::get('MFConfig.PushNotificationTest.passPhrase');
$APNS = Config::get('MFConfig.PushNotificationTest.APNS');
// Open new context for streaming and set certificate as well as passphrase
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', '../App/Certificates/ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
stream_context_set_option($ctx, 'ssl', 'cafile', '../App/Certificates/entrust_2048_ca.cer');
// Open connection to APNS
$fp = stream_socket_client($APNS, $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
// If no connection could be made then fail with error, otherwise connect
if (!$fp) {
exit("Failed to connect: $err, $errstr" . PHP_EOL);
}
echo 'Connected to APNS' . PHP_EOL;
// Create the payload body
$body['aps'] = array(
'alert' => "MEDIFAKTOR Einsatz",
'sound' => 'default'
);
// Encode the payload as JSON
$payload = json_encode($body);
// Build the binary notification
$msg = chr(0) . pack('n', 32) . pack('H*', $pushToken) . pack('n', strlen($payload)) . $payload;
// Send to server
$result = fwrite($fp, $msg, strlen($msg));
// If no result is available, the message was not delivered.
if(!$result) {
echo 'Message not delivered.' . PHP_EOL;
} else {
echo 'Message successfully delivered.' . PHP_EOL;
}
// Close connection
fclose($fp);
}
}
मैं के सिलसिले परीक्षण किया हैं:
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert ck.pem -debug -showcerts -CAfile entrust_2048_ca.cer
और यह स्थिति 0 (ठीक), जो ठीक है देता है मुझे लगता है? लेकिन जब मैं फ़ंक्शन को कॉल करता हूं तो मुझे मिलता है: failed loading cafile stream
https://github.com/immobiliare/ApnsPHP/ क्या आपने इस संग्रह को चेक किया है। – Ugur