Skip to content

Instantly share code, notes, and snippets.

@larrybolt
Created October 6, 2013 22:58
Show Gist options
  • Save larrybolt/6860232 to your computer and use it in GitHub Desktop.
Save larrybolt/6860232 to your computer and use it in GitHub Desktop.
Quick test of reportr!
<?php
$url = 'http://www.reportr.io';
$apikey = 'API KEY';
// Create a model, you only need to do this once, check afterwards at:
// http://www.reportr.io/api/API-KEY/models
$data = array(
'namespace' => 'ping',
'event' => 'ping',
'name' => 'Ping',
'icon' => '',
'description' => 'Ping test'
);
$json = json_encode($data);
$encoded = base64_encode($json);
file_get_contents("$url/api/$apikey/model/set?callback=?&data=$encoded");
// Send some data to the model just created
$data = array(
'event' => 'ping',
'namespace' => 'ping',
'properties' => array(
time => '3',
title => 'test'
)
);
$json = json_encode($data);
$encoded = base64_encode($json);
file_get_contents("$url/api/$apikey/events/track?callback=?&data=$encoded");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment