Dim lastRow As Variant
lastRow = Range("B" & Rows.Count).End(xlUp).Row
Dim vvArray As Variant
vvArray = Range("B12:B" & lastRow).Value
Dim vvArrayString() As String
ReDim vvArrayString(1 To UBound(vvArray))
For i = 1 To UBound(vvArray)
vvArrayString(i) = vvArray(i, 1)
Next
Dim TCRequestItem As Object
Set TCRequestItem = CreateObject("WinHttp.WinHttpRequest.5.1")
TCRequestItem.Open "POST", "url", False
TCRequestItem.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
TCRequestItem.send ("keyArray=" + vvArrayString)
我不明白为什么要设置vvarray
然后设置vvarrayString
?为什么不通过循环B列直接转到vvarrayString
呢?
Dim LastRow as Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
Dim vvArrayString(1 to LastRow-11)
For i = 12 to LastRow
vvArrayString(1-11) = Range("B" & i).text
Next
这应该为您正确设置数组,然后您可以继续下一位代码(http请求)。
编辑:http请求也可以使用类似的循环,因为它是一个简单的重复模式。然而,您需要一个单独的变量;
Dim strPostReq as String 'here's your separate variable
For x = 1 to LastRow-11
'Just add the same pattern to the end of the string each time
strPostReq = strPostReq & "keyArray[" & x-1 & "]=" & vvArrayString(x) & "&"
Next
'Then remove the last '&' from the string
strPostReq = Left(strPostReq, Len(strPostReq) - 1)
用简单的话来说,我想发送这个数据到服务器,使用Volley Post Request。 它有一个整数和一个字符串,我得到的响应是Jsonarray 我尝试过以下方法,但都不管用 > 因为它是json数组请求,我不能在参数中发送数据,因为第三个参数只需要JsonArray,我必须发送JsonObject,所以保持为null 我不能把它放在中,因为值的1是整数,并且它只接受字符串 getparams(
问题内容: 我尝试使用Apiary,并制作了一个通用模板以将JSON发送到模拟服务器并具有以下代码: 这段代码无法正确发送JSON,但我不知道为什么。每个调用中的JSON字符串可以不同。我不能用这个。 问题答案: 我对打n并不熟悉,但是使用Golang的程序包可以很好地工作(游乐场):
我尝试使用Apariy,制作了一个通用模板,将JSON发送到模拟服务器,并获得以下代码: 这段代码不能正确发送JSON,但我不知道为什么。JSON字符串可以在每次调用中不同。我不能为此使用。
请求方式: "|3|2|url,content|\r" 参数: url 设置Post请求的url链接 content post请求的数据 返回值: "|3|code|data|\r" 参数: code http请求返回的成功或者错误码 成功:code = 200 获取数据失败:code = -1 http请求字段错误:code = 1 data http请求返回的数据 Arduino样例: sof
我得到以下错误 响应数据为空。我做错了什么,或者我在代码中遗漏了什么?
我试图通过Spring RestTemplate将字符串数组/列表发送到REST服务器。 .13:11:35.370[http-nio-8443-exec-5]信息C.F.S.I.ServiceGatewayImpl-articleid:563F2DBD9BB0152BB0EA058E] 我可以看出这是错误的,因为列表不应该在第一项上有一个“[”,而在最后一项上有一个“]”。 我读过如何通过Spr