我正在开发APNS (苹果推送通知服务)。我按照教程所说的那样做:
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
$fp = stream_socket_client(
'ssl://gateway.sandbox.push.apple.com:2195', $err,
$errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);但在我的服务器上,我必须通过HTTP代理连接到互联网,所以我总是收到超时错误的代码。如何为使用ssl协议的strem_socket_client设置http代理?
发布于 2012-11-30 07:05:21
最好的方法是使用stream_context_create设置proxy选项
$ctx = stream_context_create(array(
'http' => array(
'proxy' => 'tcp://127.0.0.1:8888',
)
)
);有关完整的http选项,请参阅http://php.net/manual/en/context.http.php。也许您必须将request_fulluri设置为true。
https://stackoverflow.com/questions/11607731
复制相似问题