-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexample.php
More file actions
33 lines (27 loc) · 735 Bytes
/
Copy pathexample.php
File metadata and controls
33 lines (27 loc) · 735 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
<?php
define( 'EMFL_PLATFORM_API_TOKEN', '123abc' );
/**
* Get a singleton API library instance
* @return Emfl_Platform_API
*/
function emfl_get_api_instace() {
static $wrapper = NULL;
if(!empty($wrapper)) return $wrapper;
require_once('api.class.php');
$wrapper = new Emfl_Platform_API( EMFL_PLATFORM_API_TOKEN, 'emfl_api_error' );
return $wrapper;
}
/**
* Callback function if an API error occurs.
* Output to page.
* @param string $msg
*/
function emfl_api_error( $msg ) {
echo '<h3>ERROR</h3><pre>' . $msg . '</pre>';
}
/*
* Here we go! Do a test ping and outupt the result.
*/
$emfl = emfl_get_api_instace();
$result = $emfl->ping();
echo '<h1>RESULT</h1><pre>' . var_export($result, TRUE) . '</pre>';