Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Draw This
($0.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-18-2009, 03:31 PM   #1 (permalink)
MikesTooLz
Registered Member
 
MikesTooLz's Avatar
 
Join Date: Jan 2009
Location: Miami, Florida
Posts: 211
MikesTooLz is on a distinguished road
Send a message via AIM to MikesTooLz
Default issues with PHP script Push Notification

the app is registering with the sandbox already and getting the token.
im trying a sample script to see if I can just get a test mssage to go through but I am getting the following error when the script is run.

Quote:
Warning: stream_socket_client() [function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure in push.php on line 21

Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in push.php on line 21

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in push.php on line 21
Failed to connect 0

the script im usng is as follows:
Quote:
<?php
$deviceToken = 'XXXXXXXXXXXXXXXXXXXXXX'; // masked for security reason
// Passphrase for the private key (ck.pem file)
// $pass = '';
// Get the parameters from http get or from command line
$message = $_GET['message'];
$badge = (int)$_GET['badge'] or $badge = (int)$argv[2];
$sound = $_GET['sound'] or $sound = $argv[3];
// Construct the notification payload
$body = array();
$body['aps'] = array(’alert’ => $message);
if ($badge)
$body['aps']['badge'] = $badge;
if ($sound)
$body['aps']['sound'] = $sound;
/* End of Configurable Items */
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
// assume the private key passphase was removed.
// stream_context_set_option($ctx, 'ssl', 'passphrase', $pass);
$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);
if (!$fp) {
print "Failed to connect $err $errstrn";
return;
}
else {
print "Connection OKn";
}
$payload = json_encode($body);
$msg = chr(0) . pack("n",32) . pack('H*', str_replace(' ', '', $deviceToken)) . pack("n",strlen($payload)) . $payload;
print "sending message :" . $payload . "n";
fwrite($fp, $msg);
fclose($fp);
?>
MikesTooLz is offline   Reply With Quote
 

» Advertisements
» Online Users: 572
13 members and 559 guests
djbrooks111, Dump3, equalsabracket, esoteric, HowEver, iekei, ITCreative, lzwasyc, msovani, OneGoodApp, PapaSmurf, Sean Coco, tranvutuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 174,548
Threads: 93,727
Posts: 401,266
Top Poster: BrianSlick (7,954)
Welcome to our newest member, rosalvadx91
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:30 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.