구글 푸쉬 FCM이 서버에서 안되는데...
본문
서버상에서 체크해야할 부분이 뭐가 있을까요?
cafe24에선 동일한 소스로 되는데
제가 하고 있는 서버에선 안되더라구요.
php버전은 5.5이고
curl상황은 아래 이미지와 같습니다.
혹시 안드로이드 푸쉬가 안되는 부분이 있을까요?
fcm 소스는 아래와 같습니다.
/********************* 소스 **********************/
function sendPushNotification($tokens, $message) {
ignore_user_abort();
//ob_start();
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array(
'to' => $tokens,
'data' => array("message" =>$message)
);
define('GOOGLE_API_KEY', 'aaa')
$headers = array(
'Authorization:key='.GOOGLE_API_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
echo $result;
/*
if($result === false)
die('Curl failed ' . curl_error());
curl_close($ch);
return $result;
ob_flush();
*/
}