Module: util/http

HTTP utilities.

Methods


<static> get(ii, cb)

Get HTTP/HTTPS data.
Remark: use 'file://' for local test automation.
Parameters:
Name Type Description
ii Object Input Information
Properties
Name Type Description
url string URL ('http://', 'https://' or 'file://')
encoding string Text encoding (default 'utf8')
cb function Callback
Properties
Name Type Description
er Error
data string
Example
var http = mbot.load('util/http');
http.get({
    url: 'https://github.com/search?q=chat'
}, function(er, data) {
    if (er)
        console.log('error: ' + er);
    else
        console.log('data: ' + data);
});