| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/innoceanapi.wondermakr.com/innocean-fifa-api/app/controller/ |
Upload File : |
<?php
// This is so I don't accidentally commit the secret
// In production this file would be on the client side so it's up to them to keep it secret
$apiSecret = $cfg['apiSecret'];
// API endpoint
$url = $cfg['url'] . '/api';
// Use the query string to send new pins for testing.
// This function is just for us for now. In production only Kanvas would be sending us pins (and not like this)
// Both $_GET['a'] and $_GET['pin'] must be set
/*
if ( isset($_GET['a']) && $_GET['a'] == 'send_pin' && isset($_GET['pin']) ) {
$data = [
'action' => 'send_pin',
'pin' => $_GET['pin']
];
} else {
exit('query string not set');
}
*/
// check_pin_soundoff expects an array of 1 to 4 pins
// Results will come back for whether each PIN exists and its database id
// the database id(s) would be stored for that session and sent back with the score
/*
$data = [
'action' => 'check_pin_soundoff',
'pins' => ['01234','51234']
];
*/
// check_pin_airfresh expects a single pin
// Results will come back for whether each PIN exists and its database id
// the database id(s) would be stored for that session and sent back with the score
/*
$data = [
'action' => 'check_pin_airfresh',
'pin' => '51234'
];
*/
// check_pin_playmaker expects a single pin
// Results will come back for whether each PIN exists and its database id
// the database id(s) would be stored for that session and sent back with the score
/*
$data = [
'action' => 'check_pin_playmaker',
'pin' => '51234'
];
*/
//////////
// update_pin_playmaker, update_pin_cheer, update_pin_airfresh
// expects the array of database IDs (even though only the cheer booth would have multiple)
/////////
// update_pin_playmaker will require two scores - pas (passing) and int (inteligence)
/*
$data = [
'action' => 'update_pin_playmaker',
'ids' => [5],
'pas' => 123,
'int' => 456
];
*/
// update_pin_soundoff will require a single score that is applied to all the pins & the video filename.
/*
$data = [
'action' => 'update_pin_soundoff',
'ids' => [2,4,6],
'score' => 587,
'filename' => 'timestamp_video.mp4'
];
*/
// update_pin_airfresh will require the filename of the finished output.
/*
$data = [
'action' => 'update_pin_airfresh',
'ids' => [3],
'filename' => 'timestamp_filename.png'
];
*/
// Encode the data
$body = json_encode($data, JSON_UNESCAPED_SLASHES);
$signature = hash_hmac('sha256', $body, $apiSecret);
$headers = [
'Content-Type: application/json',
'X-Signature: ' . $signature
];
// Initialize cURL
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => $headers
]);
// Execute request
$response = curl_exec($ch);
// Handle errors
if ($response === false) {
echo 'cURL Error: ' . curl_error($ch);
curl_close($ch);
exit;
}
// Get HTTP status code
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
// Output results
echo "HTTP Status: {$httpCode}\n";
echo "Response:\n";
echo $response . "\n";
$result = json_decode($response, true);
print_r ($result);
?>