php code igniter using curl for ios push notifications
I didn't read your question carefully.
You are trying to send push notifications to Apple via an HTTPS request. That can't work. Apple Push Notifications only work with a specific binary format over TCP protocol.
As a provider you communicate with Apple Push Notification service over a binary interface. This interface is a high-speed, high-capacity interface for providers; it uses a streaming TCP socket design in conjunction with binary content. The binary interface is asynchronous.
There are many problems with your code :
You seem to mix GCM code with APNS code. $fields = array('device_tokens' => $gcm_ids, 'data' => $message, 'aps' => $aps);
looks similar to what you would do when sending a message to Google Cloud Messaging server. But GCM is completely different than APNS, so why did you think that would work?
You are sending a JSON body, which is what works with GCM, but APNS use a binary format. While the payload within the binary message to APNS contains an encoded JSON String (which looks similar to your $aps
JSON), you can't package it within another JSON and expect it to work.
And adding https://
in front of the APNS server can't make it support HTTPS, since it wasn't implemented to support HTTPS (nor HTTP).
I suggest you use stream_context
, which works.