3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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'));
based on 2CHHE
Output for 5.6.0 - 5.6.38, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.1
Authorization: amxcde:UiRT3A2YPV3JiJp00MxJsFo6C9SSjVtANm86KGDVSJ8=:10:1508797800