Net.httpRequest
Net.httpRequest($method, $url, $data='', $headers={}) -> string|map
Description
Send an HTTP request and get the response.
$method is the HTTP method. (e.g. 'GET', 'POST')
$url must be a URL TypeString.
$data can be a string containing the raw request 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.httpRequest('GET', url'https://example.com')
// With headers
$headers = {
'Cookie': 'sessionId=1234'
}
$data = { myVar: 123 }
$content = Net.httpRequest(
'POST'
url'https://example.com'
$data
$headers
)