Created
May 5, 2010 11:03
-
-
Save sudhanshuraheja/390641 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$streamContext = stream_context_create(); | |
stream_context_set_option($streamContext, 'ssl', 'local_cert', 'apns-dev.pem'); | |
$apns = stream_socket_client( | |
'ssl://feedback.sandbox.push.apple.com:2196', | |
$error, | |
$errorString, | |
60, | |
STREAM_CLIENT_CONNECT, | |
$streamContext | |
); | |
if($apns) { | |
while ($data = fread($apns, 38)) { | |
$feedback = unpack("N1timestamp/n1length/H*devtoken", $data); | |
echo "Sent message at " . date("r", $feedback['timestamp']); | |
echo " with length " . $feedback['length']; | |
echo " to token " . $feedback['devtoken']; | |
} | |
fclose($fp); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment