Skip to content

http

Methods

get(url, cbk)

Type Name Description Default
string url URL to use none
cbk function(data) Callback to get the result of GET query none

Performs GET query to a url. cbk will be called with text that web server returns

1
2
3
4
5
function on_get(data)
    print(data)
end

http.get('https://example.com', on_get)

post(url, params, cbk)

Type Name Description Default
string url URL to use none
table{ string=string } params Associative table of POST parameters none
cbk function(data) Callback to get the result of POST query none

Performs POST query to a url with parameters. cbk will be called with text that web server returns

1
2
3
4
5
function on_get(data)
    print(data)
end

http.post('https://example.com', { some_thing = 'A value', ['second_thing'] = 'Yes' }, on_get)