var page = require(\'webpage\').create();
page.onResourceRequested = function(request) {
console.log(\'Request \' + JSON.stringify(request, undefined, 4));
console.log( \'---------------------------------------------------------------------\' );
};
page.onResourceReceived = function(response) {
console.log(\'Receive \' + JSON.stringify(response, undefined, 4));
console.log( \'---------------------------------------------------------------------\' );
};
page.open(\'https://www.baidu.com\', function(status) {
console.log("Status: " + status);
if(status === "success") {
page.render(\'example.png\');
}
phantom.exit();
});
example.png