title: how to send push notification in ios from server using php in newer version of ios, without using pem file
body: <p>i have sent notification in older versions of ios. but in newer version i m not able to create .pem file. Someone told me that pem file is no longer required to send notification from server. But with bad luck i am not able to find any link regarding this. Someone please guide me how to send push notifications from server in newer version of ios.
  I am stuck in sending notification since last week. Please help.
  Here is the code i am using </p>
  
  <pre><code>private function pushnotification($deviceToken, $message, $type, $badge, $userid, $jobid) {
      $passphrase = '123456';
  
      $ctx = stream_context_create();
  
     // $file = base_path().  "/public/WenderCastPush.pem";
      //stream_context_set_option($ctx, 'ssl', 'local_cert', $file);
      stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
      stream_context_set_option($ctx, 'ssl', 'verify_peer', false);
      stream_context_set_option($ctx, 'ssl', 'verify_peer_name', false);
      stream_context_set_option($ctx, 'ssl', 'allow_self_signed', true);
      //stream_context_set_option($ctx, 'ssl','ciphers', 'TLSv1');
      // Open a connection to the APNS server
     // $fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);
      $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);
  
      if (!$fp)
          exit("Failed to connect: $err $errstr" . PHP_EOL);
  
      $body['aps'] = array(
          //'badge' =&gt; +1,
          'alert' =&gt; $message,
          'sound' =&gt; 'default',
          //'title' =&gt; $message,
          'type' =&gt; $type, 
          'userid' =&gt; $userid ,
          'jobid' =&gt; $jobid, 
      );
      // Encode the payload as JSON
      $payload = json_encode($body);
  
  
      $msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
  
      // Send it to the server
      $result = fwrite($fp, $msg, strlen($msg));
  
      if (!$result)
          $responce = 'Message not delivered' . PHP_EOL;
      else
          $responce = 'Message successfully delivered' . PHP_EOL;
  
      // Close the connection to the server
      fclose($fp); 
      return $responce;
  }
  </code></pre>