Exemple #1
0
	body {max-width: 960px; margin: 0 auto}
	pre {background: #999; color: white; padding: 0 4px}
	input, textarea {width: 100%; font: inherit; background: #eee; border: 0; padding: 2px 4px}
	button {font: inherit}
</style>
<body>
<h1>GCMnotifier Client</h1>

<pre><?php 
require __DIR__ . "/../GCMnotifier.php";
error_reporting(E_ERROR);
$client = new GCMnotifier();
if (@$_POST['command'] == 'send') {
    $data = ['title' => $_POST['title'], 'body' => $_POST['body'], 'id' => (string) time()];
    $notification = ['to' => $_POST['to'], 'data' => $data, "message_id" => (string) time()];
    $result = $client->send($notification);
}
if (@$_POST['command'] == 'stop') {
    $result = $client->send('stop');
}
?>
</pre>

<?php 
if (isset($result)) {
    ?>
	<p>Result: <?php 
    echo json_encode($result);
    ?>
</p>
<?php