title: how to do push notification from android from php
body: <p>hi iam trying to send notification from my php web server to android mobile...but i am getting response as </p>
  
  <pre><code>Unauthorized Error 401
  </code></pre>
  
  <p>below is my code</p>
  
  <pre><code>&lt;?php $url = 'https://android.googleapis.com/gcm/send';
  $device_ids = array('devise ID' );
  $headers = array('Authorization: key=api key',
  'Content-Type: application/json');
  $t_data = array();
  $t_data['message'] = array('Someone commented on your business.');
  $t_json = array( 'registration_ids' =&gt; $device_ids , 'data' =&gt; $t_data );
  
  $ch = curl_init();
  
  curl_setopt($ch, CURLOPT_HTTPHEADER,$headers );
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode( $t_json ) );
  curl_setopt($ch, CURLOPT_URL, $url);
  $result = curl_exec($ch);
  if ($result === FALSE)
  {
   die('Curl failed: ' . curl_error($ch));
  }
  
  curl_close($ch);
  
  echo $result;
  ?&gt;
  </code></pre>
  
  <p>how can i resolve this error</p>