· 8 years ago · Jan 11, 2018, 05:56 AM
1$apikey = 'YOUR_API_KEY';
2$apisecret = 'YOUR_API_SECRET';
3$nonce = time();
4$uri = 'https://bleutrade.com/api/v2/account/getbalances?
5apikey='.$apikey.'&nonce='.$nonce;
6$sign = hash_hmac('sha512',$uri,$apisecret);
7$ch = curl_init($uri);
8curl_setopt($ch, CURLOPT_HTTPHEADER, array('apisign:'.$sign)); // you can
9add the signature at the end of the uri if you prefer: &apisign=...
10$execResult = curl_exec($ch);
11$obj = json_decode($execResult);
12
13Dim sApiKey As String = "Enter API Key"
14 Dim sApiSecret As String = "Enter API Secret Key"
15
16 Dim sURI As String = "https://bleutrade.com/api/v2/account/getbalances?apikey=" + sApiKey
17 Dim secretkey() As Byte = System.Text.Encoding.ASCII.GetBytes(sApiSecret)
18 Dim uri() As Byte = System.Text.Encoding.ASCII.GetBytes(sURI)
19 Dim myhmac As New HMACSHA512(secretkey)
20 Dim bSign As Byte() = myhmac.ComputeHash(uri)
21 Dim wrGETURL As WebRequest
22
23 wrGETURL = WebRequest.Create(sURI)
24 wrGETURL.Headers.Add("apsign:" & Convert.ToBase64String(bSign))
25 Dim objStream As Stream
26 objStream = wrGETURL.GetResponse.GetResponseStream()
27
28 Dim objReader As New StreamReader(objStream)
29 Dim sLine As String = ""
30 Dim i As Integer = 0
31
32 Do While Not sLine Is Nothing
33 i += 1
34 sLine = objReader.ReadLine
35 If Not sLine Is Nothing Then
36
37 End If
38 Loop