This is because you passed a context with http
options to stream_socket_client()
- and more to the point you used an ssl://
wrapper instead of http://
or https://
.
The stream_socket_*()
functions do not know that you are implementing HTTP so they do not use the http
context options - in order for this to work you would need to do e.g.
$fp = fopen('https://gateway.sandbox.push.apple.com:2195/path/to/file', 'r', false, $ctx);
This is probably a better idea anyway, because it is unlikely you would need the granular control that implementing HTTP manually would give you for the Apple APIs.