Note that there are some explanatory texts on larger screens.

plurals
  1. POApple Push with proxy and stream_context
    primarykey
    data
    text
    <p>I have to send push notification to iOS devices. My connection has to be enabled through a proxy. I tried everything but without success. I have an error 110 Connection Timed Out. It's working with cURL if I just try to connect to Apple push's address. I don't know where the problem is. Proxy config ? PHP stream_context wrong implementation ?</p> <p>Here's my code :</p> <pre><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; </code></pre> <p>Do you have an idea ?</p> <p><strong>EDIT:</strong></p> <p>Can it be directly linked to Squid ? I just figured out the proxy is running with Squid. I also try with <code>fopen()</code> function instead of <code>stream_socket_client()</code> but it seems it doesn't allow ssl protocol. </p> <p>Here's my var_dump outputs : <em>bool(false) int(110) string(20) "Connection timed out"</em></p> <p>I also have this warning : Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in /share/www/website/test.php on line 22</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload