Imports System.Text
Imports System.IO
Imports System.Security.Cryptography
Public Class Form1
Private Sub Form1_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LstType.Items.Add("buy")
LstType.Items.Add("sell")
LstPair.Items.Add("ltc_usd")
LstPair.Items.Add("ltc_btc")
LstPair.Items.Add("btc_usd")
lstmeth.Items.Add("Trade")
lstmeth.Items.Add("getinfo")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim postData As String
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("https://www.cryptsy.com/api"), HttpWebRequest)
Dim randomn As String
Dim keyer As String = LCase("YourKey") 'your key goes here
Dim secret As String = "YourSecretKey" 'your secret goes here
randomn = CLng(DateTime.UtcNow.Subtract(New DateTime(1970, 1, 1)).TotalSeconds)
postData = "method=" & lstmeth.SelectedItem & "&nonce=" & randomn
Dim KeyByte() As Byte = Encoding.ASCII.GetBytes(secret)
Dim HMAcSha As New HMACSHA512(Encoding.ASCII.GetBytes(secret))
Dim messagebyte() As Byte = Encoding.ASCII.GetBytes(postData)
Dim hashmessage() As Byte = HMAcSha.ComputeHash(messagebyte)
Dim Sign As String = BitConverter.ToString(hashmessage)
Sign = Sign.Replace("-", "")
postReq.Method = "POST"
postReq.KeepAlive = False
postReq.Headers.Add("Key", keyer)
postReq.Headers.Add("Sign", LCase(Sign))
postReq.ContentType = "application/x-www-form-urlencoded"
postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
postReq.ContentLength = messagebyte.Length
Dim postreqstream As Stream = postReq.GetRequestStream()
postreqstream.Write(messagebyte, 0, messagebyte.Length)
postreqstream.Close()
Dim postresponse As HttpWebResponse
postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
thepage = thepage.Replace(Chr(34), Chr(39))
MsgBox(thepage)
End Sub
End Class
And just in case :-P
BTC: 1pJJjL7CsujpmBTkhwjoDDEkhDCKt9nna