I wrote the below script to read the feedback data. But, for some reasons, I am not receiving any data from the server. Can you kindly let me know whats wrong with the script. Also, if you have any working php script for feedback service, can you kindly share it...
regards, DD.
<?php
$ctx = stream_context_create();
stream_context_set_option($ctx, ssl , local_cert , ck.pem );
// Set time limit to indefinite execution
set_time_limit (0);
// Set the ip and port we will listen on
$address = ssl://feedback.sandbox.push.apple.com ;
$port = 2196;
// Create a TCP Stream socket
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
echo "PHP Socket Server started at " . $address . " " . $port . "
";
// Bind the socket to an address/port
socket_bind($sock, $address, $port) or die( Could not bind to address );
// Start listening for connections
socket_listen($sock);
//loop and listen
while (true) {
/* Accept incoming requests and handle them as child processes */
$client = socket_accept($sock);
// Read the input from the client – 1024 bytes
$input = socket_read($client, 1024);
}
// Close the client (child) socket
socket_close($client);
// Close the master sockets
socket_close($sock);
?>