<?php
	ini_set('display_errors', 'On');
	error_reporting(E_ALL);

	//store reg id in array
	$other_reg_ids[] = 'cxt3MTxVrNQ:APA91bGBKgaOqNk1X5JmUjtWhdHM_KKh9WYvE5egb9iGJ8ulM7BbuEzvxfklyAD5KZWEDlNwZbgJZaR8uypC3-CwPfCTIPHo1UVpTqLZUpLyvorIgiykTRpk2dUAW1heU8LpF1HjKFZw';

	//API Key
	$api_key = 'AIzaSyBcrrQw9HFn3wnFPzsE7ogjpqsI_drfbj4';
				
	// Set other POST variables for GCM
	$url = 'https://android.googleapis.com/gcm/send';
		
	$headers = array("Authorization: key=$api_key", "Content-Type: application/json");
								
	$fields = array("notification" =>array("title"=>"test", "body"=>"test Body"),"content_available"=>true, "registration_ids"=>$other_reg_ids, "data"=>array("email"=>"test", "cloudSyncTS"=>"test", "type"=>'add friend', "action"=>'add friend'), "priority"=>'high');
	//echo json_encode($fields);
	// Open connection
	$ch = curl_init();
				 
	// Set the url, number of POST vars, POST data
	curl_setopt($ch, CURLOPT_URL, $url);	 
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
				        
	// Disabling SSL Certificate support temporarly
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
				 
	curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
				 
	// Execute post
	$result = curl_exec($ch);
				
	echo "result: " . $result;

	if ($result === FALSE) {		
		die('Curl failed: ' . curl_error($ch));
	}
				
	// Close connection
	curl_close($ch);
	
	//error_log("Cool Error message\n");
?>