test.php
972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?
phpinfo();
exit;
$ch = curl_init();
$msgJson = array(
"collapse_key" => "score_update" ,
"time_to_live" => 1 ,
"delay_while_idle" => true,
"data" => array(
"flag" => 1,
"message" => 1,
"badge" => 1
),
"registration_ids" => Array("APA91bGgecGR2cNrL_BxUYI69xC_4IquqnCa-047W6tRSX9CbJQVVR_oGvtqO_W_h6Ah9GOFwZWsiq08G_k1-dHZpkXW8OgBcXszFUN6QVTEr2RwQxEE26T1IdFMBedpvhOFeR-hU4du")
) ;
$msg = json_encode($msgJson) ;
$headers = array(
"Content-Type: application/json",
"Content-Length: ". strlen($msg),
"Authorization: key=" . "AIzaSyBmoURv31T4FLmsf_SwoLRRZRijktAMzO0"
);
curl_setopt($ch, CURLOPT_URL, "https://android.googleapis.com/gcm/send");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
$result = curl_exec($ch);
echo $result;
curl_close($ch);
?>