投稿のお試しも兼ねて。
get.js
var page = require('webpage').create()
,system = require('system')
,ua, url, output;
if (system.args.length != 4) {
console.log('[Error] Invalid Argument...');
phantom.exit();
} else {
url = system.args[1];
output = system.args[2];
ua = system.args[3];
page.settings.userAgent = ua;
page.open(url, function (status) {
if (status !== 'success') {
console.log('[Error] Unable to load the [' + url + '] ...');
phantom.exit();
} else {
window.setTimeout(function () {
page.render(output);
console.log(page.content);
phantom.exit();
}, 200);
}
});
}