AMPscript
Get
IsCHTMLBrowser
Post
Validate Your Server-Side JavaScript using WSProxy
Issues an HTTP POST request to the provided URL. The function returns a JSON object that contains a status value and the HTTP response.
This function only works with HTTP on port 80 and HTTPS on port 443.
1HTTP.Post(destinationUrl, contentType, content, headerNames[], headerValues[])The HTTP.Post() function has these parameters.
destinationUrl (string): Required. The destination URL for the HTTP POST request.contentType (string): Required. The value to pass for the Content-Type header.content (string): Required. The content of the POST request.headerNames (array): Required. An array of header names to include in the request.headerValues (array): Required. An array of header values to include in the request.HTTP requests created by this function automatically include the host and content-length headers. The value of host is always set to the domain of the URL that the request was sent to. The value of content-length is always set to the length of the content in the request.
Note
This example issues an HTTP POST request and outputs the resulting JSON object.
1<script runat="server">
2 Platform.Load('Core','1');
3 var url = "https://example.com/forms/myForm.html";
4 var contentType = "text/xml";
5 var payload = "<test>test123</test>";
6 var headerNames = ["MyTestHeader1", "MyTestHeader2"];
7 var headerValues = ["MyTestValue1", "MyTestValue2"];
8 var result = HTTP.Post(url, contentType, payload, headerNames, headerValues);
9
10 Write(result.StatusCode + "<br>");
11 Write(result.Response);
12</script>