我正在尝试使用 libcurl 构建一个 HTTP 表单,但我无法让它正常工作。每次我调用curl_formadd
它都会返回CURL_FORMADD_OPTION_TWICE
。有关此错误的唯一信息表明 libcurl 认为我正在尝试添加两个具有相同名称的表单元素,即使它是第一次调用curl_formadd
并且我只添加一个元素!
Declare Function curl_global_init Lib "libcurl" (flags As Integer) As Integer
Declare Function curl_formadd Lib "libcurl" (FirstItem As Ptr, LastItem As Ptr, Option1 As Integer, Value1 As Ptr, Option2 As Integer, Value2 As Ptr, EndMarker As Integer) As Integer
Const CURLFORM_COPYCONTENTS = 2
Const CURLFORM_COPYNAME = 1
Const CURLFORM_END = 17
Dim formname, formvalue As MemoryBlock
formname = "NAME"
formvalue = "CONTENTS"
If curl_global_init(3) = 0 Then
Dim first, last As Ptr
Dim err As Integer
err = curl_formadd(first, last, CURLFORM_COPYNAME, formname, CURLFORM_COPYCONTENTS, formvalue, CURLFORM_END)
Break
' err is 2 (CURL_FORMADD_OPTION_TWICE)
End If
这个错误想告诉我什么?