Sending multiple iPhone push notifications + APNS + PHP

Simple way to do it without use any file. You can call it multiple times with different tokeid. $ctx = stream_context_create(); stream_context_set_option($ctx, ‘ssl’, ‘local_cert’, ‘ckipad.pem’); stream_context_set_option($ctx, ‘ssl’, ‘passphrase’, $passphrase); $fp = stream_socket_client(‘ssl://gateway.sandbox.push.apple.com:2195’, $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); //if (!$fp) //exit(“Failed to connect amarnew: $err $errstr” . PHP_EOL); //echo ‘Connected to APNS’ . PHP_EOL; // Create … Read more

Get device token for push notification

NOTE: The below solution no longer works on iOS 13+ devices – it will return garbage data. Please use following code instead: + (NSString *)hexadecimalStringFromData:(NSData *)data { NSUInteger dataLength = data.length; if (dataLength == 0) { return nil; } const unsigned char *dataBuffer = (const unsigned char *)data.bytes; NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)]; … Read more