我有如下CURL请求。
卷曲https://xxxxxx.com/api/xxx/version/xxxxx -d “ apiOperation = CREATE_SESSION” -d“ apiPassword = xxxxxxxxx” -d “ interaction.returnUrl = http://xxxxxx” -d“ apiUsername = xxxxxxx” -d “商家= xxxxxx” -d“ order.id = xxxxxx” -d“ order.amount = xxx” -d “ order.currency = xxxx”
我需要实现使用VB.net发送相同的请求 尝试以下操作时如何出错?
Dim myReq As HttpWebRequest
Dim myResp As HttpWebResponse
myReq = HttpWebRequest.Create("https://xxxxxx.com/api/xxxx/version/xxxxx")
myReq.Method = "GET"
myReq.ContentType = "application/x-www-form-urlencoded"
Dim myData As String = "-d 'apiOperation=CREATE_SESSION' -d 'apiPassword=xxxxxxxx' -d 'interaction.returnUrl=http://xxxxxx/xxxxx.html' -d 'apiUsername=xxxxx' -d 'merchant=xxxxx' -d 'order.id=xxxxx' -d 'order.amount=100.00' -d 'order.currency=xxxxx'"
myReq.GetRequestStream.Write(System.Text.Encoding.UTF8.GetBytes(myData), 0, System.Text.Encoding.UTF8.GetBytes(myData).Count)
myResp = myReq.GetResponse
Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
Dim myText As String
myText = myreader.ReadToEnd