구글 푸쉬 FCM이 서버에서 안되는데...

구글 푸쉬 FCM이 서버에서 안되는데...

QA

구글 푸쉬 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();
   */
}

이 질문에 댓글 쓰기 :

답변 2

curl 뿐만 아리나 json도 설치하고 설정하셔야 합니다.

 define('GOOGLE_API_KEY', 'aaa') 끝에  세미콜론도 빠져 있네요.

답변을 작성하시기 전에 로그인 해주세요.
전체 124,108 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT