Code: Select all
Procedure webServiceUpload(pictureData.s)
curl = curl_easy_init()
url.s = str2curl(myURL$)
agent.s = str2curl("pbcurl/1.0")
cookie.s = str2curl("agent=" + myAgent$ + ";")
post.s = str2curl("pic=" + "Data:image/png;base64," + pictureData)
header.s = str2curl("Cache-Control: no-cache")
If curl
curl_easy_setopt(curl,#CURLOPT_URL,@url)
curl_easy_setopt(curl,#CURLOPT_IPRESOLVE,#CURL_IPRESOLVE_V4)
curl_easy_setopt(curl,#CURLOPT_COOKIE,@cookie)
curl_easy_setopt(curl,#CURLOPT_POSTFIELDS,@post)
curl_easy_setopt(curl,#CURLOPT_USERAGENT,@agent)
curl_easy_setopt(curl,#CURLOPT_TIMEOUT,30)
curl_easy_setopt(curl,#CURLOPT_FOLLOWLOCATION,1)
*header = curl_slist_append(0,header)
curl_easy_setopt(curl,#CURLOPT_HTTPHEADER,*header)
curl_easy_setopt(curl,#CURLOPT_WRITEFUNCTION,@curlWriteData())
res = curl_easy_perform(curl)
resData.s = curlGetData()
curl_easy_getinfo(curl,#CURLINFO_RESPONSE_CODE,@resHTTP)
curl_easy_cleanup(curl)
Else
Debug "can't init curl!"
EndIf
EndProcedure
;AddWindowTimer(MainWindow, 123, 300)
webService(Base64_Image2.s)