서버상에서 체크해야할 부분이 뭐가 있을까요?
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();
*/
}
답변 2개 / 댓글 2개
curl 뿐만 아리나 json도 설치하고 설정하셔야 합니다.
답변에 대한 댓글 1개
define('GOOGLE_API_KEY', 'aaa') 끝에 세미콜론도 빠져 있네요.
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.
서버쪽 세팅은 솔직히 하나도 모릅니다.