I am writing a .c apns (apple push notification server) application,
I have the rest of the program working ie connecting to the servers establishing ssl, json encoding the message etc.
However I am stuck on the part that converts the token to a hex string part.
Example values
$deviceToken is "4DBCD414F624842E581972E65D2DAA4B96279B209BD0CE10AB12E52AEA48A670"
$apnsMessage is "{"aps":{"alert":"testing","badge":1,"sound":"elephant.aiff"}}"
İşte şu anda iş yapan bir php pasajı.
$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $deviceToken)) . chr(0) . chr(strlen($message)) . $message;
fwrite($this->apnsConnection, $apnsMessage);
Any help would be appreciated. Thanks Peter