title: send Massive push notification to GCM
body: <p>I have to send Push Notifications with different messages for large number of devices(More than 10k devices per day).But sometimes its not receiving all of the devices.I set up a function <code>pushNotificationToUsers($heading,$message,$registraionids)</code> to send the push notification and I  am not sure about my method is correct ,if i am wrong please correct me.</p>
  
  <pre><code>function  pushNotificationToUsers($heading,$message,$registraionids){
          //array of registration ids in $registraionids         
          $key="xxxxxxxxxxx";
          // Set POST variables
          $url = 'https://android.googleapis.com/gcm/send';
          $fields = array(
                          'registration_ids'  =&gt;,$registraionids,
                          'data'              =&gt; array( "message" =&gt; $message,"title"=&gt;$heading,"soundname"=&gt;"beep.wav" ),
                          );
          $headers = array(
                              'Authorization: key=' . $key,
                              'Content-Type: application/json'
                          );
          // Open connection
          $ch = curl_init();
          // Set the url, number of POST vars, POST data
          curl_setopt( $ch, CURLOPT_URL, $url );
          curl_setopt( $ch, CURLOPT_POST, true );
          curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
          curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
          curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) );
          // Execute post
          $result = curl_exec($ch);
          // Close connection
          curl_close($ch);
  
          }
  </code></pre>
  
  <p>I'm using php in my serverside</p>