views:

47

answers:

1

Hi guys, i used an example to build an push notification service....it worked greate on the development version, but now that my application is in production, i can not get it to work....i have rebuild my .pem file with production certificates, but by now...,nothing....heres my code in PHP to push:

<?php
$token = '504e06eeeeee26b82c084a7e69af1fed3a7f8a236d1862190 4e205c4a77c16b2'; // masked for security reason

// Create a stream to the server
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', 'apns-dev.pem');

$apns = stream_socket_client('ssl://gateway.push.apple.com:2195', $error, $errorString, 60, STREAM_CLIENT_CONNECT, $streamContext);

echo "Error: $error <hr>";
echo "ErrorString: $errorString <hr>";


// You can access the errors using the variables $error and $errorString
$message= 'test ';

// Now we need to create JSON which can be sent to APNS
$load = array( 'aps' => array( 'alert' => $message, 'badge' => 0, 'sound' => 'default'));
$payload = json_encode($load);

// The payload needs to be packed before it can be sent
$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $token)) . chr(0) . chr(strlen($payload)) . $payload;

// Write the payload to the APNS
fwrite($apns, $apnsMessage);
echo "just wrote " . $payload;

// Close the connection
fclose($apns);
?>

the strange part is that when i run the code i got no errors....the return:

http://localhost/_processos/iphone-push.php

Error: 0 ErrorString: just wrote {"aps":{"alert":"test","badge":0,"sound":"defa ult"}}

any one?

A: 

can you diff the php.ini from the two servers?

Full Decent
sorry ....there are only one server (localhost) and i used this same host on development to test push notifications, and they work perfecly....
Rodrigo
just tried to use in the development profile now, but it does not work anymore.....
Rodrigo
just notest ,,,it is workin...on others iphones, on my own (development) it was not...
Rodrigo