Sha256: 675675c4b56d5bed3ad663a43573658a7e6b626202fd44ad8ee38fc1c332e731

Contents?: true

Size: 613 Bytes

Versions: 2

Compression:

Stored size: 613 Bytes

Contents

var page = require('webpage').create(),
    address = phantom.args[0];

if (phantom.args.length === 0) {
    console.log('Usage: netlog.js <some URL>');
    phantom.exit();
} else {

    page.onResourceRequested = function (req) {
        console.log('requested: ' + JSON.stringify(req, undefined, 4));
    };

    page.onResourceReceived = function (res) {
        console.log('received: ' + JSON.stringify(res, undefined, 4));
    };

    page.open(address, function (status) {
        if (status !== 'success') {
            console.log('FAIL to load the address');
        }
        phantom.exit();
    });
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phantomjs.rb-0.0.2 vendor/phantomjs-1.4.1_OSX/examples/netlog.js
phantomjs.rb-0.0.1 vendor/phantomjs-1.4.1_OSX/examples/netlog.js