Skip to content

Instantly share code, notes, and snippets.

@papoms
Created August 25, 2012 20:54
Show Gist options
  • Save papoms/3470859 to your computer and use it in GitHub Desktop.
Save papoms/3470859 to your computer and use it in GitHub Desktop.
load a list of urls with phantomjs
var urls = [
'http://keyworddomains.com',
'http://blog.keyworddomains.com',
'http://timer.keyworddomains.com'
];
var page = require('webpage').create();
function process(){
if (urls.length == 0){
phantom.exit();
} else{
url = urls.pop();
page = require('webpage').create();
page.open(url, onFinishedLoading)
}
}
function onFinishedLoading(status){
// get the currentUrl
var currentUrl = page.evaluate(function() {
return document.location.href;
});
console.log('Loading ' + currentUrl + ' finished with status: ' + status);
page.release();
process();
}
process();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment