Page 1 of 1

push notification issue

Posted: Thu Apr 10, 2014 6:27 am
by santoshkumar
hai , iam santosh i have a one problem with push notifications, iam develop the code for push notifications
but in the godaddy hosting server it shows Failed to connect 111 Conections refused. please help me

Re: push notification issue

Posted: Thu Apr 10, 2014 4:39 pm
by seandisanti
The error seems pretty straightforward, connection was refused. For more specific help, you will need to show some code for us to diagnose. Make sure you replace sensitive connection values (credentials etc) before posting code

Re: push notification issue

Posted: Fri Apr 11, 2014 1:29 am
by santoshkumar
i wrote this code


$message="hai this is for testing";
$deviceToken=$row['device_token'];


$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', 'welcome');

// Open a connection to the APNS server $passphrase
$fp = stream_socket_client('ssl://gateway.sandbox.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,
'sound' => 'default',
'badge' => '1',
'type' => 'notification'
);

// 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;

// 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);



in this i have an r=error in godaddy Failed to connect: 111 Connection refused.

can we need any ssl certificates for godaddy ?

Re: push notification issue

Posted: Fri Apr 11, 2014 8:14 am
by seandisanti
Here's some code for opening SSL stream:
http://www.php.net/manual/en/function.s ... .php#85345

Re: push notification issue

Posted: Fri Apr 11, 2014 10:57 pm
by santoshkumar
same code run in my local wamp server its working fine. but in godaddy server host its problem, is it any problem with firewalls?

PDF compress Query

Posted: Tue Apr 15, 2014 3:55 pm
by santoshkumar
Hi, how to compres pdfs in php

Re: push notification issue

Posted: Wed Apr 16, 2014 1:14 am
by seandisanti
Yes, godaddy can be blocking ports that would cause the issues you're having. http://lmgtfy.com/?q=write+pdf+with+php