Created
April 11, 2017 11:37
-
-
Save wernersmit/a64b12aafe41923b5eed1e1cda13a72f to your computer and use it in GitHub Desktop.
Relay backend post in Classic ASP - vbscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
' Compile QueryStirng From POST | |
DataToSend = "" | |
For Each Item In Request.Form | |
fieldName = Item | |
fieldValue = Request.Form(Item) | |
DataToSend = DataToSend & fieldName & "=" & fieldValue & "&" | |
Next | |
'Response.Write "DataToSend: " & DataToSend | |
'Response.End | |
dim xmlhttp | |
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP") | |
xmlhttp.Open "POST","https://example.com/api/post",false | |
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" | |
xmlhttp.send DataToSend | |
Response.ContentType = "text/json" | |
Response.Write xmlhttp.responseText | |
Set xmlhttp = nothing | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment