I need to send a push notification to iOS devices. My connection must be enabled through a proxy. I tried everything, but to no avail. I have a 110 Connection Timed Out error. It works with cURL if I just try to connect to the Apple push address. I do not know where the problem is. Proxy configuration? PHP stream_context error?
Here is my code:
$ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', 'certificate.pem'); stream_context_set_option($ctx, 'ssl', 'passphrase', 'my_passphrase'); stream_context_set_option($ctx, 'ssl', 'verify_peer', false); stream_context_set_option($ctx, 'http', 'proxy', 'tcp://my-proxy.net:8080'); stream_context_set_option($ctx, 'http', 'request_fulluri', true); $fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err,$errstr, 60, STREAM_CLIENT_CONNECT, $ctx); var_dump($fp); var_dump($err); var_dump($errstr); exit;
Do you have an idea?
EDIT:
Can I link directly to Squid? I just realized that the proxy works with Squid. I am also trying to use fopen() instead of stream_socket_client() , but it does not seem to allow the ssl protocol.
Here my var_dump outputs: bool (false) int (110) string (20) "Connection timeout"
I also have this warning: Warning: stream_socket_client (): cannot connect to ssl: //gateway.sandbox.push.apple.com: 2195 (connection timeout) in /share/www/website/test.php on line 22
source share