Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload a file with POST (multipart/form-data) using VBA [duplicate]

Tags:

vba

Does anyone know how to construct a POST DATA body in VBA? I'm trying to upload rather lengthy strings via a post call using the "Microsoft.XMLHTTP" object. I'm not tied to using that object for making the HTTP request either.

like image 957
Moses Ting Avatar asked Nov 26 '22 20:11

Moses Ting


1 Answers

How about

Dim XMLHttp As Object: Set XMLHttp = CreateObject("Microsoft.XMLHTTP")
XMLHttp.Open "POST", "http://www.lfkfklkf.com", False
XMLHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
XMLHttp.send "q=ploppy&x=cake"
Debug.print XMLHttp.responseText
Set XMLHttp = Nothing
like image 70
Alex K. Avatar answered Feb 07 '23 14:02

Alex K.