<?php
function signRequest($domain, $method, $public_key, $private_key, $data=array()){
$data = array_filter($data); // Normalise data
if(array_key_exists('request_timestamp', $data))
{
$data['request_timestamp'] = (int) $data['request_timestamp'];
}
ksort($data);
$data = json_encode($data);
$buffer = array($domain, $method, $data, $public_key);
$buffer_str = implode(":", $buffer);
return hash_hmac('sha256', $buffer_str, $private_key);
}
//echo signRequest("neom.dev", "products", "c7912e9a71d7208f", "767f791f93a272d3f4554116", []);
echo time();
- Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
- 1504708333
preferences:
106.29 ms | 402 KiB | 157 Q