The blog post that you referenced is pretty old and really didn’t cover easyapns. It had it’s own PHP implementation that really did nothing more than let you send a single scripted push. Back in the day when I was messing with it, I got EasyAPNS running and it worked. What I couldn’t do is get EasyAPNS running from inside of Wordpress. Unfortunately that project went away so I didn’t spend a lot of time pursuing it.
I have the PHP source from that blog post if you want to get something to just test with. I in no way can support this… use it at your own experimentation:
\<?php // Put your device token here (without spaces): // this is the token you get with the remote registration event in Corona SDK $deviceToken = '7f3cfeb48a2a708f875252625fa84c51eb2d4d38ae1b448b04a8e1b12dc984ae'; // Put your private key's passphrase here: $passphrase = 'yourkeypassword'; // Put your alert message here: $message = 'My Corona SDK push notification!'; //////////////////////////////////////////////////////////////////////////////// $ctx = stream\_context\_create(); stream\_context\_set\_option($ctx, 'ssl', 'local\_cert', 'ck\_prod.pem'); stream\_context\_set\_option($ctx, 'ssl', 'passphrase', $passphrase); // Open a connection to the APNS server $fp = stream\_socket\_client( 'ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM\_CLIENT\_CONNECT|STREAM\_CLIENT\_PERSISTENT, $ctx); if (!$fp) exit("Failed to connect: $err $errstr" . PHP\_EOL); echo 'Connected to APNS' . PHP\_EOL; // Create the payload body $body['aps'] = array( 'alert' =\> $message, 'badge' =\> 1, 'sound' =\> 'default' ); // Encode the payload as JSON $payload = json\_encode($body); // Build the binary notification $msg = chr(0) . pack('n', 32) . pack('H\*', $deviceToken) . pack('n', strlen($payload)) . $payload; echo strlen($msg); // Send it to the server $result = fwrite($fp, $msg, strlen($msg)); if (!$result) echo 'Message not delivered' . PHP\_EOL; else echo 'Message successfully delivered' . PHP\_EOL; // Close the connection to the server fclose($fp); ?\>
ck_prod.pem is the PEM version of your key. The passphrase is the password for that key. This is set for a production server, not the development server. If you want the development server, change ck_prod.pem to ck_dev.pem (and of course upload the right key to go with it). Then the URL is something like: ssl://gateway.sandbox.push.apple.com:2195