<?php
$data = [
'shopId'=>777,
'nonce'=>time(),
];
ksort($data);
$sign = hash_hmac('sha256', implode('|', $data), $api_key);
$data['signature'] = $sign;
$request = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.fk.life/v1/balance');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$result = trim(curl_exec($ch));
curl_close($ch);
$response = json_decode($result, true);