Created
August 11, 2010 18:51
-
-
Save indexzero/519516 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var httpAgent = require('http-agent'), | |
sys = require('sys'); | |
var agent = httpAgent.create('www.google.com', ['finance', 'news', 'images']); | |
agent.addListener('next', function (agent) { | |
setTimeout(function () { | |
sys.puts('Body of the current page: ' + agent.body); | |
sys.puts('Response we saw for this page: ' + agent.response); | |
// Go to the next page in the sequence | |
agent.next(); | |
}, 200); | |
}); | |
agent.addListener('stop', function (agent) { | |
sys.puts('the agent has stopped'); | |
}); | |
agent.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment