Skip to content

Instantly share code, notes, and snippets.

@svnlto
Forked from ryanrolds/gist:1491554
Created December 17, 2011 22:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svnlto/1491564 to your computer and use it in GitHub Desktop.
Save svnlto/1491564 to your computer and use it in GitHub Desktop.
svnlto
function request(callback) {
var http, options;
http = require("http");
options = {
host: "api.outofme.de",
port: 80,
path: "/graphics",
method: "GET"
};
http.get(options, function(res) {
var data = "";
res.on("data", function(chunk) {
return data += chunk;
});
res.on("end", function() {
callback(null, data);
});
}).on('error', function(error) {
callback(error);
});
}
//Usage
request(function(error, body) {
console.log(body);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment