<?php
$headers = array('Content-Type:application/json', 'Authorization:key=AIzaSyAwhIjAqve0UP91qse-iL6f41Vu1s6gMTg');
$link = mysql_connect('localhost', 'ID', 'PASSWORD');
$dbconnect = mysql_select_db("gcm",$link);
$result = mysql_query("SELECT gcm_regid FROM gcm_users");
$headers = array('Content-Type:application/json', 'Authorization:key=apikey');
$arr = array();
$arr['data'] = array();
$arr['data']['msg'] = "Hello, World";
$arr['registration_ids'] = array();
$arr['registration_ids'][0] = "regid";
//$conidx=0;
//while($row = mysql_fetch_array($result))
//{
// $arr['registration_ids'][$conidx] = $row['gcm_regid'] ;
// $conidx++;
//}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arr));
$response = curl_exec($ch);
if ($result === FALSE)
{
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);
mysql_close($link);
//$response = json_decode($response,true);
echo $response;
?>
단일전송 밑 Multicast 성공했습니다.
단일 전송시에는 문제가 없던 Multicast시 Message 내용이 표시가 되질 않습니다.
영어로 하든 한글로 하든 아예 뜨지가 않네요. 푸시는 날라오긴 하지만 내용이 안뜹니다.
푸쉬를 받을 저희 어플의 GCM 기본 구성은
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
참고 하였으며 위를 이용한 단일전송은 문제없이 한글 영어 전송이 됩니다.
하지만 제가 작성한 Multicast (위 소스)는 푸쉬는 날라오지만 내용이 뜨질 않네요.
문제가 무엇일까요??