Skip to content

Instantly share code, notes, and snippets.

@sethbonnie
Created April 29, 2014 00:41
Show Gist options
  • Save sethbonnie/11388050 to your computer and use it in GitHub Desktop.
Save sethbonnie/11388050 to your computer and use it in GitHub Desktop.
var http = require('http');
var base_url = 'http://letsrevolutionizetesting.com/challenge.json?id='
function challenge(id) {
http.get(base_url+id, function(res) {
var result = [];
res.on('data', function(chunk) {
result.push(chunk);
});
res.on('end', function(chunk) {
result = JSON.parse(result.join(''));
if (result['follow']) {
var new_id = result['follow'].match(/\d+/)[0];
console.log(new_id);
challenge(new_id);
}
else {
console.log(result);
}
});
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
}
challenge('756775492');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment