---
schema_version: "1"
id: c4ca265569dc1c3610953a4e37b4a03e72e20d93e5858434c0a1b4b56de0357f
title: Platform.Function.HTTPGet()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/guides/mc-programmatic-content/ssjs_platformContentSyndicationHTTPGet.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformContentSyndicationHTTPGet.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 347d9d68c62617e9650a22a40ea4199b4ff9754efbdd2ce2ca6e526b11cd01c5
products:
  - Marketing Cloud Engagement APIs and Programmatic Languages
  - Marketing Cloud
---
# Platform.Function.HTTPGet()

Retrieves information from a URL by issuing an HTTP GET request. This function only works with HTTP on port 80 and HTTPS on port 443. The function times out after 30 seconds.

## Syntax

```
Platform.Function.HTTPGet(1, 2, 3, 4, 5, 6)
```

## Properties

The function has the properties listed in this table.

| Ordinal | Type    | Description                                                                                                                                                                                                                    |
| ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `1`     | String  | Required. The URL to retrieve content from.                                                                                                                                                                                    |
| `2`     | Boolean | Required. Indicates whether the request continues if an error occurs during the process. If the value is `true`, the request terminates if an error occurs. If the value is `false`, the request continues if an error occurs. |
| `3`     | Numeric | Indicates how the function handles a URL that returns empty content. A value of `0` allows empty content. A value of `1` returns an error. A value of `2` skips the subscriber.                                                |
| `4`     | Array   | Required. An array of header names to include in the GET request.                                                                                                                                                              |
| `5`     | Array   | Required. An array of header values that correspond to the header names defined in 4.                                                                                                                                          |
| `6`     | String  | The name of a variable that stores the status code for the request.                                                                                                                                                            |

## Return Values

This function returns a numeric status.

- A value of `0` indicates that the request completed successfully.
- A value of `-1` indicates that the URL wasn’t found.
- A value of `-2` indicates that error occurred in the HTTP request.
- A value of `-3` indicates that the function completed successfully but didn’t return any content.

## Usage

This example retrieves data from a URL by using a GET request.

```js
<script runat="server">
  var status = [0];

  try {
    var content = Platform.Function.HTTPGet(
        "https://example.com",
        false,
        0,
        ["x-request-id"],
        ["sampleValue"],
        status);
    if(status[0] == 0) {
      Platform.Response.Write(content);
    };
  } catch(e) {
    Platform.Response.Write(Platform.Function.Stringify(e));
  };
</script>
```

## See Also

- [HTTP.Get](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_httpGet.md)
- [Script.Util.HttpGet](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_platformContentSyndicationScriptUtilHttpGet.md)
