Skip to content

Instantly share code, notes, and snippets.

@washingtonsoares
Created March 6, 2016 15:29
Show Gist options
  • Save washingtonsoares/6a129e04acecb61a1e83 to your computer and use it in GitHub Desktop.
Save washingtonsoares/6a129e04acecb61a1e83 to your computer and use it in GitHub Desktop.
var http = require('http');
//The url we want is: 'www.random.org/integers/?num=1&min=1&max=10&col=1&base=10&format=plain&rnd=new'
var options = {
host: 'api.postmon.com.br',
path: '/v1/rastreio/ect/PI939559055BR'
};
callback = function(response) {
var str = '';
//another chunk of data has been recieved, so append it to `str`
response.on('data', function (chunk) {
str += chunk;
});
//the whole response has been recieved, so we just print it out here
response.on('end', function () {
console.log(str);
});
}
http.request(options, callback).end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment