-
-
Notifications
You must be signed in to change notification settings - Fork 617
http.get
João Matos edited this page Sep 21, 2015
·
17 revisions
Gets an HTTP resource from the specified URL as a string.
http.get("url", progress, headers)
url
is the URL to be downloaded. file
is the destination path where the resource will be saved. progress
is an optional Lua callback function that receives two numeric arguments representing total and current download progress in bytes. headers
is an optional Lua table with HTTP headers to be used on the request.
Resource as a string if successful, otherwise nil and an error message.
local res = http.get("http://example.com/api.json")
local res = http.get("http://example.com/api.json", nil, {"From: Premake", "Referer: Premake"})
HTTPS requests are not supported yet.
Premake 5.0 or later.