No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
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.
HTTP.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.
<script runat="server">
Platform.Load('Core','1');
var url = "https://example.com/forms/myForm.html";
var contentType = "text/xml";
var payload = "<test>test123</test>";
var headerNames = ["MyTestHeader1", "MyTestHeader2"];
var headerValues = ["MyTestValue1", "MyTestValue2"];
var result = HTTP.Post(url, contentType, payload, headerNames, headerValues);
Write(result.StatusCode + "<br>");
Write(result.Response);
</script>