This is from the CURL documentation
-F, --form
(HTTP SMTP IMAP) For HTTP protocol family, this lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using the Content-Type multipart/form-data according to RFC 2388.
When a form is submitted to Classic ASP using a content-type of multipart/form-data
the only method available is Request.BinaryRead()
as Request.Form
is for application/x-www-form-urlencoded
data.
Here is a quick example of calling Request.BinaryRead()
to get you started:
<%
'Should be less than configured request limit in IIS.
Const maxRequestSizeLimit = ...
Dim dataSize: dataSize = Request.TotalBytes
Dim formData
If dataSize < maxRequestSizeLimit Then
'Read bytes into a SafeArray
formData = Request.BinaryRead(dataSize)
'Once you have a SafeArray its up to you to process it.
...
Else
Response.Status = "413 PAYLOAD TOO LARGE"
Response.End
End If
%>
Parsing a SafeArray isn't easy
If you want to still use Request.Form
you can do by specifying the form parameters in the CURL command using -d
instead of -F
. From the documentation;
-d, --data
(HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded. Compare to -F, --form.
So the CURL command would be something like;
curl -X POST \
http://go.mytest-service.com/ \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d fff=vvvvv \
-d rrrr=ddddd \
-d xx=something
You would then retrieve the xx
parameter in Classic ASP using;
<%
Dim xx: xx = Request.Form("xx")
%>
Useful Links