I'm trying to construct an HTTP form using libcurl but I can't get it to work properly. Every time I call curl_formadd
it returns CURL_FORMADD_OPTION_TWICE
. The only information about this error indicates that libcurl thinks I'm trying to add two form elements with the same name, even though its the first call to curl_formadd
and I'm only adding one element!
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
What is this error trying to tell me?