I write code for send webhook in Currensy-Rest-api:
https://currency.com/ru/general-rest-api-information
for this i need to form signature HMAC sha256, in example of currensy i have
[echo "symbol=LTC%2FBTC&side=BUY" | openssl dgst -sha256 -hmac "SECRETKEY"]
can i use:
$signature = hash_hmac('sha256', $raw, $signkey);
like analog
realy i try but API give me answer: {"code":-1025,"msg":"Invalid API-key, IP, or permissions for action"}
):
As the documention say : all the query string has to be signed. Becarefull with the need of urlencode. This PHP example give the same result as the documentation :
<?php
$raw = "symbol=LTC%2FBTC&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559";
$signkey = "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j";
$signature = hash_hmac('sha256', $raw, $signkey, false);
echo $signature; //ebec6528b2beb508b2417fa33453a4ad28c1aae8097bb243caa60d0524036f50