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

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

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-02-2011, 12:03 AM   #1 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 3
thelionking is on a distinguished road
Default Push Notifications APNS suddenly stopped working- sandbox - php

Hello Everyone,

I am working on a app that uses push notification.It was working fine earlier and suddenly stopped working. My php code is

PHP Code:
<?php

$deviceToken 
''// masked for security reason
// Passphrase for the private key (ck.pem file)
$pass 'appendit';
// Get the parameters from http get or from command line
$message $_GET['message'] or $message $argv[1] or $message 'Test 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''apns-dev.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$errstr60STREAM_CLIENT_CONNECT$ctx);
if (!
$fp) {
print 
"Failed to connect $err $errstrn";
return;
}
else {
print 
"Connection OK \n";
}
$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);
?>
I am getting Connection OK sending message :{"aps":{"alert":"Test Message"}} while running from browser. Any idea what may be wrong there ?

Thanks
thelionking is offline   Reply With Quote
Old 05-02-2011, 12:20 AM   #2 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 3
thelionking is on a distinguished road
Default Any ideas ?

Any ideas ?
thelionking is offline   Reply With Quote
Old 08-08-2011, 05:39 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 1
deaa is on a distinguished road
Default

hello,
Did you solve it? I have same issue

thank you
deaa is offline   Reply With Quote
Old 08-08-2011, 05:52 AM   #4 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 3
thelionking is on a distinguished road
Smile The issue was with certificate

Quote:
Originally Posted by deaa View Post
hello,
Did you solve it? I have same issue

thank you
The issue was with certificate, rebuild your certificate and try again.

Refer : How to build an Apple Push Notification provider server (tutorial) Boxed Ice Blog
thelionking is offline   Reply With Quote
Reply

Bookmarks

Tags
apns notifications, php, sanbox

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 341
11 members and 330 guests
dansparrow, iOS.Lover, lorrettaui53, MikaelBartlett, Nobbsy, oztemel, pbart, PlutoPrime, sledzeppelin, thephotographer, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:55 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0