Logo Anfibia Reactor ™ - User Guide
Copyright © 2013 Anfibia Software. All Rights Reserved.
www.anfibia-soft.com
Plugins : API : HttpClient.new

Summary

Creates an HTTP client object.

Syntax

local httpRequest = HttpClient.new()

Parameters

none

Returns

httpClient : HttpClient object (Lua table).

Description

Creates an HttpClient object that can be used to send HTTP requests. The object returned is a table that contains the following elements:

Examples

local httpClient = HttpClient.new()

httpClient.params.title = 'Lua'
httpClient.params.action = 'raw'
httpClient.headers['user-agent'] = 'Reactor plugin'

local httpResponse = httpClient:request('http://en.wikipedia.org/w/index.php')

print('Content type: ' .. httpResponse.content_type)
print('Wiki text: ' .. httpResponse.content)

 

See Also

HttpClient.request