<?php
exit;
$registration_idPhone = "";


$auth = "";

sendMessage($auth, $registration_idPhone);

function sendMessage($auth, $registration_id) {
    $data = array(
        'registration_ids' => array($registration_id),
        'data' => array('title' => '제목입니다.', 'msg' => 'g4m 내용입니다.','ticker'=>'쪽지가 도착했습니다.','type'=>'comment','url'=>'http://www.naver.com')
    );

    $headers = array(
        "Content-Type:application/json",
        "Authorization:key=" . $auth
    );

    print("<XMP>");
    print(json_encode($data));
    print("\n");

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://android.googleapis.com/gcm/send");
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
    $result = curl_exec($ch);

    print_r($result);
    curl_close($ch);
}