Context APIs
Last updated
Was this helpful?
Was this helpful?
{
"status": "success",
"data": {
"lang": "eng",
"auth": {
"level": "wifiarea",
"tenantId": "1001",
"wifiareaId": "3246b0001"
}
}
}{
"status": "success",
"data": {
"customer": {
"is_logged": false,
"lang": "eng"
},
"hotspot": {
"city": "Livorno, Italy",
"id": "9067",
"identifier": "685112345D_illiade",
"latitude": "45.960782503827",
"longitude": "12.091283106750",
"mac_address": "685112345D",
"name": "Odissea",
"state": "Livorno",
"tag": "hotspot",
"zip": "Livorno",
},
"tenant": {
"name": "Taylor's Tenant",
"read_only": false,
"tenant_id": "1001"
},
"wifiarea": {
"name": "Livorno Venue",
"wifiarea_id": "18cde0005"
}
}
}{
"status": "success",
"data": {
"customer":{
"is_logged":true,
"lang":"eng",
"id":"rlC.6yTePhzYg",
"first_name":"John",
"last_name":"Doe",
"username":"706B5C1D",
"gender":"",
"birth_date":"0000-00-00 00:00:00",
"phone":"",
"phone_prefix":"",
"email":"john.doe@cloud4wi.com",
"mac_address":[]
},
"hotspot": {
"city": "Livorno, Italy",
"id": "9067",
"identifier": "685112345D_illiade",
"latitude": "45.960782503827",
"longitude": "12.091283106750",
"mac_address": "685112345D",
"name": "Odissea",
"state": "Livorno",
"tag": "hotspot",
"zip": "Livorno",
},
"tenant": {
"name": "Taylor's Tenant",
"read_only": false,
"tenant_id": "1001"
},
"wifiarea": {
"name": "Livorno Venue",
"wifiarea_id": "18cde0005"
}
}
}< ?php
define('C4W_ENV_SPLASHPORTAL_URL', "https://splashportal.cloud4wi.com");
define('C4W_ENV_CONTROLPANEL_URL', "https://volare.cloud4wi.com");
define('C4W_ENV_MYAPPS_GET_SK_URL', "/controlpanel/1.0/bridge/sessions/");
function callApi() {
if (isset($_GET['sk']))
{
$sk = $_GET['sk'];
}
// Check to see if any of the places where SK is set exists
if(isset($sk) && !empty($sk)) {
// Concatenate URL
$url = constant('C4W_ENV_CONTROLPANEL_URL') . constant('C4W_ENV_MYAPPS_GET_SK_URL') . $sk; // https://volare.cloud4wi.com/controlpanel/1.0/bridge/sessions
// Barebones call to the API using PHP curl
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url
));
$result = curl_exec($curl);
$session = json_decode($result, true);
// Create customer variable
$c4w = array();
if(isset($session['data']) && !empty($session['data'])) {
$c4w = $session['data'];
}
// Return false if status of API call is not success
if($session['status'] == 'success') {
return $c4w;
}
}
return false;
}
// GET DATA FROM SESSION
$data = callApi();
// Retrieving a specifc attribute
$phone = $data['customer']['phone'];
?>