<? $reg_id="디바이스 토큰을 여기다 넣으세요"; $headers = array( 'Content-Type:application/json', 'Authorization:key=서버키를 여기다 넣으세요' ); $temp_msg = "Message Test"; $arr = array(); $arr['data'] = array(); $arr['data']['msg'] = "메시지"; $arr['registration_ids'] = array(); $arr['registration_ids'][0] = "$reg_id"; $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); echo $response; curl_close($ch); ?>
http://www.webmadang.net/develop/develop.do?action=read&boardid=1003&page=1&seq=80
댓글 ( 4)
댓글 남기기