├── README.md ├── apns_php.php └── verify_apns_certificate.png /README.md: -------------------------------------------------------------------------------- 1 | # PHP-Push-Notification-File 2 | PHP Server code to send APNS Push request to Apple Server. 3 | 4 | PHP Code to send Push notification. 5 | 6 | Video with complete procedure : https://youtu.be/3HGPnuiLHM0 7 | 8 | iOS Swift Code : https://github.com/sivaganeshsg/Swift-iOS-Push-Notification 9 | 10 | PHP Code : https://github.com/sivaganeshsg/PHP-Push-Notification-File 11 | 12 | YouTube Channel : https://www.youtube.com/channel/UCqsykfNSUoluIkurDnQfXWA 13 | 14 | LinkedIn Profile : https://in.linkedin.com/in/sivaganeshcom 15 | -------------------------------------------------------------------------------- /apns_php.php: -------------------------------------------------------------------------------- 1 | $message, 38 | 'sound' => 'default' 39 | ); 40 | 41 | // Encode the payload as JSON 42 | $payload = json_encode($body); 43 | // Build the binary notification 44 | $msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload; 45 | // Send it to the server 46 | $result = fwrite($fp, $msg, strlen($msg)); 47 | if (!$result) 48 | echo 'Message not delivered' . PHP_EOL; 49 | else 50 | echo 'Message successfully delivered' . PHP_EOL; 51 | // Close the connection to the server 52 | fclose($fp); 53 | 54 | ?> -------------------------------------------------------------------------------- /verify_apns_certificate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sivaganeshsg/PHP-Push-Notification-File/d3e178f0e15ff724cca89d36ba2c5f684fcdaaf1/verify_apns_certificate.png --------------------------------------------------------------------------------