I need help.
I'm trying connect a website by API, but it requests authentication. They show me example by C# but I want to change into PHP.
I use file_get_content
s for getting data.
How I have to send them in the HTML Header of my request with their name.
How I make signature.
There is explaining of website. in sum can you convert C# to PHP please :)
API Authentication:
All API calls related to a user account require authentication.
You need to provide 3 parameters to authenticate a request:
"X-PCK": API key
"X-Stamp": Nonce
"X-Signature": Signature
API key
You can create the API key from the Account > API Access page in your exchange account.
Nonce:
Nonce is a regular integer number. It must be increasing with every request you make.
A common practice is to use unix time for that parameter.
Signature:
Signature is a HMAC-SHA256
encoded message. The HMAC-SHA256
code must be generated using a private key that contains a timestamp and your API key
Example (C#):
string message = yourAPIKey + unixTimeStamp;
using (HMACSHA256 hmac = new HMACSHA256(Convert.FromBase64String( yourPrivateKey ))){
byte[] signatureBytes = hmac.ComputeHash(Encoding.UTF8.GetBytes(message));
string X-Signature = Convert.ToBase64String(signatureBytes));
}
After creating the parameters, you have to send them in the HTML Header of your request with their name
Example (C#):
client.DefaultRequestHeaders.Add("X-PCK", yourAPIKey);
client.DefaultRequestHeaders.Add("X-Stamp", stamp.ToString());
client.DefaultRequestHeaders.Add("X-Signature", signature);