<?php
function amx_authorization_header($id,$key,$url,$method='GET',$body=null) {
$url=strtolower(urlencode($url));
$method=strtoupper($method);
$content=empty($body)?'':base64_encode(md5($body,true));
$time=1508797800;
$nonce=10;
$data=implode('',[$id,$method,$url,$time,$nonce,$content]);
$secret=base64_decode($key);
$signature=base64_encode(hash_hmac('sha256',$data,$secret,true));
//print($data);
return 'Authorization: amx'.implode(':',[$id,$signature,$nonce,$time]);
}
amx_authorization_header('cde','abc' ,'https://broker.negociecoins.com.br/tradeapi/v1/user/balance');
print(amx_authorization_header('cde','abc' ,'https://broker.negociecoins.com.br/tradeapi/v1/user/balance'));
preferences:
55.59 ms | 412 KiB | 5 Q