Skip to content

Instantly share code, notes, and snippets.

@lemonhall
Created June 27, 2012 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lemonhall/3002691 to your computer and use it in GitHub Desktop.
Save lemonhall/3002691 to your computer and use it in GitHub Desktop.
get a 302 location
var http = require('http');
var url='http://r.autobloglink.com/?u=aHR0cDovL3BpYy5oYW5pbWFnZS5jb20vZGFiYWdpcmwvRFJFU1MvRGExMDcwNC8yLmpwZw==';
http.get(url, function(res) {
console.log("Got response: " + res.statusCode);
if(res.statusCode===302){
console.log(res.headers.location);
}
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment