test.php 972 Bytes
<?
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);

?>