Version: v0.8.1 - Beta.  We welcome contributors & feedback.

Net.httpPost

Net.httpPost($url, $postData, $headers={}) -> string|map

Description

Send an HTTP GET request and get the response.

$url must be a URL TypeString.

$postData can be a string containing the raw POST body, or a Map, which will be converted to a URL-encoded string.

$headers is an optional map of HTTP request headers.

If the response body is JSON, it will be returned as a Map. Otherwise, it will be returned as a string.

// Basic call
$content = Net.httpPost(url'https://example.com', { myVar: 1 })

// With headers
$headers = {
    'Cookie': 'sessionId=1234'
}
$content = Net.httpPost(
    url'https://example.com'
    { myVar: 1 }
    $headers
)